mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
84a0a171ea
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();
}, []);
```
59 lines
1.0 KiB
JavaScript
59 lines
1.0 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,
|
|
cloneElement,
|
|
createContext,
|
|
createElement,
|
|
createFactory,
|
|
createRef,
|
|
createServerContext,
|
|
use,
|
|
forwardRef,
|
|
isValidElement,
|
|
lazy,
|
|
memo,
|
|
cache,
|
|
startTransition,
|
|
unstable_Cache,
|
|
unstable_DebugTracingMode,
|
|
unstable_Offscreen,
|
|
unstable_getCacheSignal,
|
|
unstable_getCacheForType,
|
|
unstable_useCacheRefresh,
|
|
unstable_useMemoCache,
|
|
useId,
|
|
useCallback,
|
|
useContext,
|
|
useDebugValue,
|
|
useDeferredValue,
|
|
useEffect,
|
|
experimental_useEffectEvent,
|
|
useImperativeHandle,
|
|
useInsertionEffect,
|
|
useLayoutEffect,
|
|
useMemo,
|
|
useReducer,
|
|
useRef,
|
|
useState,
|
|
useSyncExternalStore,
|
|
useTransition,
|
|
version,
|
|
} from './src/React';
|