mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-25 06:56:56 +02:00
chore: Enable ESLint rules of hooks + fix new lint errors (#5714)
This commit is contained in:
parent
3db4fcaec7
commit
098f210890
16 changed files with 110 additions and 48 deletions
|
@ -5,12 +5,13 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import {useRef, useEffect} from 'react';
|
||||
import {useRef} from 'react';
|
||||
import {useIsomorphicLayoutEffect} from './reactUtils';
|
||||
|
||||
export function usePrevious<T>(value: T): T | undefined {
|
||||
const ref = useRef<T>();
|
||||
|
||||
useEffect(() => {
|
||||
useIsomorphicLayoutEffect(() => {
|
||||
ref.current = value;
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue