Skip to content

Commit

Permalink
fix: apply correct order of operations in useRerender (#850)
Browse files Browse the repository at this point in the history
First add one to state and then get reminder of max safe integer
  • Loading branch information
KonradLinkowski committed Jun 22, 2022
1 parent e027c94 commit 5fc735a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/useRerender/useRerender.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useCallback } from 'react';
import { useSafeState } from '..';

const stateChanger = (state: number) => state + (1 % Number.MAX_SAFE_INTEGER);
const stateChanger = (state: number) => (state + 1) % Number.MAX_SAFE_INTEGER;

/**
* Return callback function that re-renders component.
Expand Down

0 comments on commit 5fc735a

Please sign in to comment.