Closed antoniopangallo closed 3 years ago
const graterThan10 = ({ values }) => values && values['A'] + values['B'] > 10 ? undefined : 'A+B must be > 10' function App() { const [status, validation] = useValidation([graterThan10]) return ( <Form touched {...validation}> <Collection object name="values"> <Input type="number" name="A" value="1" /> <Input type="number" name="B" value="2" /> </Collection> {status.error && <label>{status.error}</label>} <button type="submit">Press to see results</button> </Form> ); }
Improvement:
Example: