Created
October 5, 2020 09:32
-
-
Save arthurvi/fbf7ffe806a7fb9e6a38ae730060314e to your computer and use it in GitHub Desktop.
ItemWrapper.jsx
This file contains 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
function ItemWrapper({ item, setItems }) { | |
const handleChange = React.useCallback( | |
function handleChange(value) { ... }, | |
[item, setItems] | |
); | |
const handleSave = React.useCallback( | |
async function handleSave() { | |
// set isSaving to true | |
await save(item); | |
// set isSaving to false | |
}, | |
[item] | |
); | |
return ( | |
<Item | |
id={item.id} | |
value={item.value} | |
isSaving={item.isSaving} | |
onSave={handleSave} | |
onChange={handleChange} | |
/> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment