An open API service indexing awesome lists of open source software.

https://github.com/vip-git/cra-react-jsonschema-form-material-ui-example

This is a small demo project showcasing compatibility of react-jsonschema-form with CRA
https://github.com/vip-git/cra-react-jsonschema-form-material-ui-example

Last synced: 12 months ago
JSON representation

This is a small demo project showcasing compatibility of react-jsonschema-form with CRA

Awesome Lists containing this project

README

          

## CRA - React JSONSchema Form Material UI - Example

This is a small demo project showcasing compatiblity of [CRA](https://github.com/facebook/create-react-app) with [react-jsonschema-form-material-ui](https://github.com/vip-git/react-jsonschema-form-material-ui)

```bash
yarn
npm start
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

#### Example Code can be [seen here](./src/App.js)
```jsx
import React from 'react';
import MaterialJsonSchemaForm from 'react-jsonschema-form-material-ui';

import schema from '../simple/schema.json';
import uiSchema from '../simple/ui-schema.json';
import givenFormData from '../simple/form-data.json';

const theme = {
palette: {
primary: {
light: '#757ce8',
main: '#3f50b5',
dark: '#002884',
contrastText: '#fff',
},
secondary: {
light: '#ff7961',
main: '#f44336',
dark: '#ba000d',
contrastText: '#000',
},
},
};

export default () => {
const [formData, setFormData] = React.useState(givenFormData);
return setFormData(formData)}
onSubmit={() => console.log('form submitted')}
/>;
};
```