Skip to content

Commit

Permalink
fix rerender issue on even calls of updates per render
Browse files Browse the repository at this point in the history
  • Loading branch information
JensRavens committed Dec 6, 2021
1 parent ceb519d commit d68fab7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useState } from 'react';

export function useForceUpdate(): () => void {
const [, updateState] = useState(true);
const [, updateState] = useState(0);
return () => {
updateState((state) => !state);
updateState((state) => state + 1);
};
}

Expand Down

0 comments on commit d68fab7

Please sign in to comment.