Skip to content

Instantly share code, notes, and snippets.

@arthurvi
Created October 5, 2020 09:35
Show Gist options
  • Save arthurvi/3bc102882e381a0b827d7e291ac04d0d to your computer and use it in GitHub Desktop.
Save arthurvi/3bc102882e381a0b827d7e291ac04d0d to your computer and use it in GitHub Desktop.
Item.jsx
const Item = React.memo(function Item({ id, value, isSaving, onChange, onSave }) {
if (isSaving) {
return <li>Saving...</li>;
}
return (
<li>
<input
value={value}
onChange={(event) => onChange(event.target.value)}
/>
<button onClick={onSave}>Save</button>
</li>
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment