/** * @license React * use-subscription.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ 'use strict'; if (process.env.NODE_ENV !== "production") { (function() { 'use strict'; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === 'function' ) { __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); } var shim = require('use-sync-external-store/shim'); // // In order to avoid removing and re-adding subscriptions each time this hook is called, // the parameters passed to this hook should be memoized in some way– // either by wrapping the entire params object with useMemo() // or by wrapping the individual callbacks with useCallback(). function useSubscription(_ref) { var getCurrentValue = _ref.getCurrentValue, subscribe = _ref.subscribe; return shim.useSyncExternalStore(subscribe, getCurrentValue); } exports.useSubscription = useSubscription; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === 'function' ) { __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); } })(); }