mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
We originally had grand plans for using this Event concept for more but
now it's only meant to be used in combination with effects.
It's an Event in the FRP terms, that is triggered from an Effect.
Technically it can also be from another function that itself is
triggered from an existing side-effect but that's kind of an advanced
case.
The canonical case is an effect that triggers an event:
```js
const onHappened = useEffectEvent(() => ...);
useEffect(() => {
onHappened();
}, []);
```
71 lines
1.7 KiB
JavaScript
71 lines
1.7 KiB
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow
|
|
*/
|
|
|
|
export {
|
|
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
|
|
act as unstable_act,
|
|
Children,
|
|
Component,
|
|
Fragment,
|
|
Profiler,
|
|
PureComponent,
|
|
StrictMode,
|
|
Suspense,
|
|
SuspenseList,
|
|
SuspenseList as unstable_SuspenseList, // TODO: Remove once call sights updated to SuspenseList
|
|
cloneElement,
|
|
createContext,
|
|
createElement,
|
|
createFactory,
|
|
createMutableSource,
|
|
createMutableSource as unstable_createMutableSource,
|
|
createRef,
|
|
createServerContext,
|
|
use,
|
|
forwardRef,
|
|
isValidElement,
|
|
lazy,
|
|
memo,
|
|
cache,
|
|
startTransition,
|
|
startTransition as unstable_startTransition, // TODO: Remove once call sights updated to startTransition
|
|
unstable_Cache,
|
|
unstable_TracingMarker,
|
|
unstable_DebugTracingMode,
|
|
unstable_LegacyHidden,
|
|
unstable_Offscreen,
|
|
unstable_Scope,
|
|
unstable_getCacheSignal,
|
|
unstable_getCacheForType,
|
|
unstable_useCacheRefresh,
|
|
unstable_useMemoCache,
|
|
useId,
|
|
useCallback,
|
|
useContext,
|
|
useDebugValue,
|
|
useDeferredValue,
|
|
useDeferredValue as unstable_useDeferredValue, // TODO: Remove once call sights updated to useDeferredValue
|
|
useEffect,
|
|
experimental_useEffectEvent,
|
|
useImperativeHandle,
|
|
useLayoutEffect,
|
|
useInsertionEffect,
|
|
useMemo,
|
|
useMutableSource,
|
|
useMutableSource as unstable_useMutableSource,
|
|
useReducer,
|
|
useRef,
|
|
useState,
|
|
useSyncExternalStore,
|
|
useTransition,
|
|
useTransition as unstable_useTransition, // TODO: Remove once call sights updated to useTransition
|
|
version,
|
|
} from './src/React';
|
|
export {jsx, jsxs, jsxDEV} from './src/jsx/ReactJSX';
|