chore: Enable ESLint rules of hooks + fix new lint errors (#5714)

This commit is contained in:
Sébastien Lorber 2021-10-20 16:09:52 +02:00 committed by GitHub
parent 3db4fcaec7
commit 098f210890
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 110 additions and 48 deletions

View file

@ -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;
});