import React from "react"; import { render } from "react-dom"; import debounce from "./debounce"; import { Form, InputGroup } from "Form"; import TextField from "@material-ui/core/TextField"; import Snackbar from "@material-ui/core/Snackbar"; import Button from "@material-ui/core/Button"; async function onSubmit( form ) { // let's pretend we have a server error form.setError("Opps, a server error"); return Promise.resolve(); }; // Debounce for 50ms const onInput = debounce(( e, inputGroup, form ) => { // Update state only of input group in focus inputGroup.checkValidityAndUpdate(); // Update "valid" property of the form form.checkValidityAndUpdate(); }, 50 ); const MyForm = props => (
); render(