Skip to content

Commit

Permalink
Fixed ESLINT issue with usePagination.test.js file by using React.use…
Browse files Browse the repository at this point in the history
…Effect hook to update hook after execution, error: Writing to a variable defined outside a component or hook is not allowed. Consider using an effecteslint(react-compiler/react-compiler)
  • Loading branch information
wilhelmlofsten committed Sep 30, 2024
1 parent f38d286 commit 7316795
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/mui-material/src/usePagination/usePagination.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ describe('usePagination', () => {
const serialize = (items) => items.map((item) => (item.type === 'page' ? item.page : item.type));

const renderHook = (useHook) => {
const result = {};
const result = { current: null };
function TestCase() {
result.current = useHook();
const hookResult = useHook();
React.useEffect(() => {
result.current = hookResult;
}, [hookResult]);
return null;
}
render(<TestCase />);
Expand Down

0 comments on commit 7316795

Please sign in to comment.