Skip to content

Commit

Permalink
whoops, this needs to be useMemo
Browse files Browse the repository at this point in the history
  • Loading branch information
kentcdodds committed Sep 24, 2020
1 parent 0d936a5 commit fa0b922
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/screens/book.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,9 @@ function ListItemTimeframe({listItem}) {
function NotesTextarea({listItem}) {
const [mutate, {error, isError, isLoading}] = useUpdateListItem()

const debouncedMutate = React.useCallback(
() => debounceFn(mutate, {wait: 300}),
[mutate],
)
const debouncedMutate = React.useMemo(() => debounceFn(mutate, {wait: 300}), [
mutate,
])

function handleNotesChange(e) {
debouncedMutate({id: listItem.id, notes: e.target.value})
Expand Down

0 comments on commit fa0b922

Please sign in to comment.