Skip to content

Instantly share code, notes, and snippets.

@phobon
Created October 15, 2020 06:43
Show Gist options
  • Save phobon/02888a5b4d285830cc3afc2e7b23173c to your computer and use it in GitHub Desktop.
Save phobon/02888a5b4d285830cc3afc2e7b23173c to your computer and use it in GitHub Desktop.
export const ParentComponent = ({ ...props }) => {
const name = useState(null);
const address = useState(null);
const other = useState(null);
const fields = [name, address, other];
return (
<form>
{fields.map(([field, setField], index) => (
<input type="text" onChange={e => setField(e.value)} value={field} />
)}
</form>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment