refactor(theme-common): rename useDynamicCallback to useEvent (#7671)

This commit is contained in:
Sébastien Lorber 2022-06-24 12:10:03 +02:00 committed by GitHub
parent 9473508c33
commit 2c7012f706
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 15 deletions

View file

@ -16,7 +16,7 @@ import React, {
} from 'react';
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
import useIsBrowser from '@docusaurus/useIsBrowser';
import {useDynamicCallback, ReactContextError} from './reactUtils';
import {useEvent, ReactContextError} from './reactUtils';
type ScrollController = {
/** A boolean ref tracking whether scroll events are enabled. */
@ -104,7 +104,7 @@ export function useScrollPosition(
const {scrollEventsEnabledRef} = useScrollController();
const lastPositionRef = useRef<ScrollPosition | null>(getScrollPosition());
const dynamicEffect = useDynamicCallback(effect);
const dynamicEffect = useEvent(effect);
useEffect(() => {
const handleScroll = () => {