Skip to content

Commit

Permalink
listen to changes in initialValue
Browse files Browse the repository at this point in the history
  • Loading branch information
sitek94 committed Dec 12, 2020
1 parent c1c51dc commit 6c19e6d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/checkmark/checkmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ const variants = {
function Checkmark({ id, initialValue, habitId, date, disabled }) {
const [value, setValue] = React.useState(initialValue);

React.useEffect(() => {
setValue(initialValue);
}, [initialValue]);

const updateCheckmarkInDb = useUpdateCheckmarkInDb();

// Debounced update function
Expand Down

0 comments on commit 6c19e6d

Please sign in to comment.