Created
October 15, 2020 06:43
-
-
Save phobon/02888a5b4d285830cc3afc2e7b23173c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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