Skip to content

Commit

Permalink
replace fromEntries() which is not in nodejs
Browse files Browse the repository at this point in the history
  • Loading branch information
criesbeck committed Jun 26, 2019
1 parent 4cd44fe commit 93e4b43
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/useForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useState } from 'react';
const useForm = (names) => {

const [values, setValues]
= useState(Object.fromEntries(names.map(name => [name, ''])));
= useState(names.reduce((obj, name) => ({...obj, [name]: ''}), {}));

const handleChange = (event) => {
const { name, value, type, checked } = event.target;
Expand Down

0 comments on commit 93e4b43

Please sign in to comment.