Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/useForceUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import { useReducer } from 'react'
* ```
*/
export default function useForceUpdate(): () => void {
// The toggling state value is designed to defeat React optimizations for skipping
// updates when they are stricting equal to the last state value
const [, dispatch] = useReducer((state: boolean) => !state, false)
const [, dispatch] = useReducer((state: number) => ++state, 0)
return dispatch as () => void
}