Fix React hooks ESLint errors without disabling rules
Refactored components to avoid synchronous setState calls in effects by using proper React patterns: - TableOfContents: Use requestAnimationFrame to defer setState calls and useLayoutEffect for DOM measurements - CustomTheme: Use lazy state initialization for isClient and defer theme loading with requestAnimationFrame - PlaygroundContext: Use lazy initialization for localStorage hydration These changes maintain functionality while satisfying the strict react-hooks/set-state-in-effect ESLint rule. Signed-off-by: Charles de Dreuille <charles.dedreuille@gmail.com>
This commit is contained in:
@@ -9,8 +9,6 @@ const eslintConfig = defineConfig([
|
||||
'notice/notice': 'off',
|
||||
'react/forbid-elements': 'off',
|
||||
'jsx-a11y/alt-text': 'off',
|
||||
'@next/next/no-css-tags': 'off',
|
||||
'react-hooks/set-state-in-effect': 'warn',
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user