Manage React form state the easy way and validate with json-schema.
yarn add @seegno/react-formsMake sure you have at least version 16.8 of React:
yarn add react@^16.8.0import{FormProvider,useField}from'@seegno/react-forms';functionInput({ name }){const{ onChange, value }=useField(name);return(<inputname={name}onChange={event=>onChange(event.target.value)}value={value}/>);}functionForm(){return(<FormProviderjsonSchema={{properties: {foo: {type: 'string'}},type: 'object'}}onSubmit={values=>console.log('submit',values)}>{({ submit })=>(<formonSubmit={submit}><Inputname={'foo'}/><buttontype={'submit'}>{'Submit'}</button></form>)}</FormProvider>);}Run the tests from the root directory:
yarn testFound a bug or want to suggest something? Take a look first on the current and closed issues. If it is something new, please submit an issue.
It will be awesome if you can help us evolve @seegno/react-forms.
Want to help?
- Fork it.
- Install the dependencies with
yarn. - Hack away.
- Run the tests:
yarn test. - Create a Pull Request.