Socket
Socket
Sign inDemoInstall

react-redux

Package Overview
Dependencies
Maintainers
2
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-redux - npm Package Compare versions

Comparing version 7.1.0-alpha.1 to 7.1.0-alpha.2

2

dist/react-redux.min.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("redux"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","redux","react-dom"],t):t((e=e||self).ReactRedux={},e.React,e.Redux,e.ReactDOM)}(this,function(e,t,r,n){"use strict";var o="default"in t?t.default:t;function i(e,t){return e(t={exports:{}},t.exports),t.exports}var u="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";function s(){}function a(){}a.resetWarningCache=s;var c=i(function(e){e.exports=function(){function e(e,t,r,n,o,i){if(i!==u){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:s};return r.PropTypes=r,r}()}),p=o.createContext(null);var f=function(e){e()},d=function(){return f},l=null,y={notify:function(){}};var h=function(){function e(e,t){this.store=e,this.parentSub=t,this.unsubscribe=null,this.listeners=y,this.handleChangeWrapper=this.handleChangeWrapper.bind(this)}var t=e.prototype;return t.addNestedSub=function(e){return this.trySubscribe(),this.listeners.subscribe(e)},t.notifyNestedSubs=function(){this.listeners.notify()},t.handleChangeWrapper=function(){this.onStateChange&&this.onStateChange()},t.isSubscribed=function(){return!!this.unsubscribe},t.trySubscribe=function(){var e,t,r;this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.handleChangeWrapper):this.store.subscribe(this.handleChangeWrapper),this.listeners=(e=d(),t=[],r=[],{clear:function(){r=l,t=l},notify:function(){var n=t=r;e(function(){for(var e=0;n.length>e;e++)n[e]()})},get:function(){return r},subscribe:function(e){var n=!0;return r===t&&(r=t.slice()),r.push(e),function(){n&&t!==l&&(n=!1,r===t&&(r=t.slice()),r.splice(r.indexOf(e),1))}}}))},t.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=y)},e}(),m=function(e){var t,r;function n(t){var r;r=e.call(this,t)||this;var n=t.store;r.notifySubscribers=r.notifySubscribers.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r));var o=new h(n);return o.onStateChange=r.notifySubscribers,r.state={store:n,subscription:o},r.previousState=n.getState(),r}(t=n).prototype=Object.create((r=e).prototype),t.prototype.constructor=t,t.__proto__=r;var i=n.prototype;return i.componentDidMount=function(){this._isMounted=!0,this.state.subscription.trySubscribe(),this.previousState!==this.props.store.getState()&&this.state.subscription.notifyNestedSubs()},i.componentWillUnmount=function(){this.unsubscribe&&this.unsubscribe(),this.state.subscription.tryUnsubscribe(),this._isMounted=!1},i.componentDidUpdate=function(e){if(this.props.store!==e.store){this.state.subscription.tryUnsubscribe();var t=new h(this.props.store);t.onStateChange=this.notifySubscribers,this.setState({store:this.props.store,subscription:t})}},i.notifySubscribers=function(){this.state.subscription.notifyNestedSubs()},i.render=function(){return o.createElement((this.props.context||p).Provider,{value:this.state},this.props.children)},n}(t.Component);function b(){return(b=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function v(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;i.length>n;n++)0>t.indexOf(r=i[n])&&(o[r]=e[r]);return o}m.propTypes={store:c.shape({subscribe:c.func.isRequired,dispatch:c.func.isRequired,getState:c.func.isRequired}),context:c.object,children:c.any};var P,S=i(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&Symbol.for,n=r?Symbol.for("react.element"):60103,o=r?Symbol.for("react.portal"):60106,i=r?Symbol.for("react.fragment"):60107,u=r?Symbol.for("react.strict_mode"):60108,s=r?Symbol.for("react.profiler"):60114,a=r?Symbol.for("react.provider"):60109,c=r?Symbol.for("react.context"):60110,p=r?Symbol.for("react.async_mode"):60111,f=r?Symbol.for("react.concurrent_mode"):60111,d=r?Symbol.for("react.forward_ref"):60112,l=r?Symbol.for("react.suspense"):60113,y=r?Symbol.for("react.memo"):60115,h=r?Symbol.for("react.lazy"):60116;function m(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case p:case f:case i:case s:case u:case l:return e;default:switch(e=e&&e.$$typeof){case c:case d:case a:return e;default:return t}}case h:case y:case o:return t}}}function b(e){return m(e)===f}t.typeOf=m,t.AsyncMode=p,t.ConcurrentMode=f,t.ContextConsumer=c,t.ContextProvider=a,t.Element=n,t.ForwardRef=d,t.Fragment=i,t.Lazy=h,t.Memo=y,t.Portal=o,t.Profiler=s,t.StrictMode=u,t.Suspense=l,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===f||e===s||e===u||e===l||"object"==typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===y||e.$$typeof===a||e.$$typeof===c||e.$$typeof===d)},t.isAsyncMode=function(e){return b(e)||m(e)===p},t.isConcurrentMode=b,t.isContextConsumer=function(e){return m(e)===c},t.isContextProvider=function(e){return m(e)===a},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return m(e)===d},t.isFragment=function(e){return m(e)===i},t.isLazy=function(e){return m(e)===h},t.isMemo=function(e){return m(e)===y},t.isPortal=function(e){return m(e)===o},t.isProfiler=function(e){return m(e)===s},t.isStrictMode=function(e){return m(e)===u},t.isSuspense=function(e){return m(e)===l}});(P=S)&&P.__esModule&&Object.prototype.hasOwnProperty.call(P,"default");var g=i(function(e){e.exports=S}),O=g.isContextConsumer,w={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},C={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},x={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},R={};function M(e){return g.isMemo(e)?x:R[e.$$typeof]||w}R[g.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0};var E=Object.defineProperty,T=Object.getOwnPropertyNames,j=Object.getOwnPropertySymbols,_=Object.getOwnPropertyDescriptor,N=Object.getPrototypeOf,q=Object.prototype;var D=function e(t,r,n){if("string"!=typeof r){if(q){var o=N(r);o&&o!==q&&e(t,o,n)}var i=T(r);j&&(i=i.concat(j(r)));for(var u=M(t),s=M(r),a=0;i.length>a;++a){var c=i[a];if(!(C[c]||n&&n[c]||s&&s[c]||u&&u[c])){var p=_(r,c);try{E(t,c,p)}catch(e){}}}return t}return t},$=function(e,t,r,n,o,i,u,s){if(!e){var a;if(void 0===t)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[r,n,o,i,u,s],p=0;(a=Error(t.replace(/%s/g,function(){return c[p++]}))).name="Invariant Violation"}throw a.framesToPop=1,a}},A=[],F=[null,null];function U(e,t){return[t.payload,e[1]+1]}var W=function(){return[null,0]},k="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;function H(e,r){void 0===r&&(r={});var n=r.getDisplayName,i=void 0===n?function(e){return"ConnectAdvanced("+e+")"}:n,u=r.methodName,s=void 0===u?"connectAdvanced":u,a=r.renderCountProp,c=void 0===a?void 0:a,f=r.shouldHandleStateChanges,d=void 0===f||f,l=r.storeKey,y=void 0===l?"store":l,m=r.withRef,P=void 0!==m&&m,S=r.forwardRef,g=void 0!==S&&S,w=r.context,C=void 0===w?p:w,x=v(r,["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef","forwardRef","context"]);$(void 0===c,"renderCountProp is removed. render counting is built into the latest React Dev Tools profiling extension"),$(!P,"withRef is removed. To access the wrapped instance, use a ref on the connected component");$("store"===y,"storeKey has been removed and does not do anything. To use a custom Redux store for specific components, create a custom React context with React.createContext(), and pass the context object to React Redux's Provider and specific components like: <Provider context={MyContext}><ConnectedComponent context={MyContext} /></Provider>. You may also pass a {context : MyContext} option to connect");var R=C;return function(r){var n=r.displayName||r.name||"Component",u=i(n),a=b({},x,{getDisplayName:i,methodName:s,renderCountProp:c,shouldHandleStateChanges:d,storeKey:y,displayName:u,wrappedComponentName:n,WrappedComponent:r}),p=x.pure;var f=p?t.useMemo:function(e){return e()};function l(n){var i=t.useMemo(function(){return[n.context,n.forwardedRef,v(n,["context","forwardedRef"])]},[n]),s=i[0],c=i[1],p=i[2],l=t.useMemo(function(){return s&&s.Consumer&&O(o.createElement(s.Consumer,null))?s:R},[s,R]),y=t.useContext(l),m=!!n.store;$(m||!!y&&!!y.store,'Could not find "store" in the context of "'+u+'". Either wrap the root component in a <Provider>, or pass a custom React context provider to <Provider> and the corresponding React context consumer to '+u+" in connect options.");var P=n.store||y.store,S=t.useMemo(function(){return function(t){return e(t.dispatch,a)}(P)},[P]),g=t.useMemo(function(){if(!d)return F;var e=new h(P,m?null:y.subscription),t=e.notifyNestedSubs.bind(e);return[e,t]},[P,m,y]),w=g[0],C=g[1],x=t.useMemo(function(){return m?y:b({},y,{subscription:w})},[m,y,w]),M=t.useReducer(U,A,W),E=M[0][0],T=M[1];if(E&&E.error)throw E.error;var j=t.useRef(),_=t.useRef(p),N=t.useRef(),q=f(function(){return N.current&&p===_.current?N.current:S(P.getState(),p)},[P,E,p]);k(function(){_.current=p,j.current=q,N.current&&(N.current=null,C())}),k(function(){if(d){var e=!1,t=null,r=function(){if(!e){var r,n,o=P.getState();try{r=S(o,_.current)}catch(e){n=e,t=e}n||(t=null),r===j.current?C():(j.current=r,N.current=r,T({type:"STORE_UPDATED",payload:{latestStoreState:o,error:n}}))}};w.onStateChange=r,w.trySubscribe(),r();return function(){if(e=!0,w.tryUnsubscribe(),t)throw t}}},[P,w,S]);var D=t.useMemo(function(){return o.createElement(r,b({},q,{ref:c}))},[c,r,q]);return t.useMemo(function(){return d?o.createElement(l.Provider,{value:x},D):D},[l,D,x])}var m=p?o.memo(l):l;if(m.WrappedComponent=r,m.displayName=u,g){var P=o.forwardRef(function(e,t){return o.createElement(m,b({},e,{forwardedRef:t}))});return P.displayName=u,P.WrappedComponent=r,D(P,r)}return D(m,r)}}var I=Object.prototype.hasOwnProperty;function L(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function K(e,t){if(L(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(var n=0;r.length>n;n++)if(!I.call(t,r[n])||!L(e[r[n]],t[r[n]]))return!1;return!0}function Y(e){return function(t,r){var n=e(t,r);function o(){return n}return o.dependsOnOwnProps=!1,o}}function z(e){return null!=e.dependsOnOwnProps?!!e.dependsOnOwnProps:1!==e.length}function V(e,t){return function(t,r){var n=function(e,t){return n.dependsOnOwnProps?n.mapToProps(e,t):n.mapToProps(e)};return n.dependsOnOwnProps=!0,n.mapToProps=function(t,r){n.mapToProps=e,n.dependsOnOwnProps=z(e);var o=n(t,r);return"function"==typeof o&&(n.mapToProps=o,n.dependsOnOwnProps=z(o),o=n(t,r)),o},n}}function B(e,t,r){return b({},r,e,t)}var G=[function(e){return"function"==typeof e?function(e){return function(t,r){var n,o=r.pure,i=r.areMergedPropsEqual,u=!1;return function(t,r,s){var a=e(t,r,s);return u?o&&i(a,n)||(n=a):(u=!0,n=a),n}}}(e):void 0},function(e){return e?void 0:function(){return B}}];function J(e,t,r,n){return function(o,i){return r(e(o,i),t(n,i),i)}}function Q(e,t,r,n,o){var i,u,s,a,c,p=o.areStatesEqual,f=o.areOwnPropsEqual,d=o.areStatePropsEqual,l=!1;function y(o,l){var y,h,m=!f(l,u),b=!p(o,i);return i=o,u=l,m&&b?(s=e(i,u),t.dependsOnOwnProps&&(a=t(n,u)),c=r(s,a,u)):m?(e.dependsOnOwnProps&&(s=e(i,u)),t.dependsOnOwnProps&&(a=t(n,u)),c=r(s,a,u)):b?(y=e(i,u),h=!d(y,s),s=y,h&&(c=r(s,a,u)),c):c}return function(o,p){return l?y(o,p):(s=e(i=o,u=p),a=t(n,u),c=r(s,a,u),l=!0,c)}}function X(e,t){var r=t.initMapStateToProps,n=t.initMapDispatchToProps,o=t.initMergeProps,i=v(t,["initMapStateToProps","initMapDispatchToProps","initMergeProps"]),u=r(e,i),s=n(e,i),a=o(e,i);return(i.pure?Q:J)(u,s,a,e,i)}function Z(e,t,r){for(var n=t.length-1;n>=0;n--){var o=t[n](e);if(o)return o}return function(t,n){throw Error("Invalid value of type "+typeof e+" for "+r+" argument when connecting component "+n.wrappedComponentName+".")}}function ee(e,t){return e===t}var te,re,ne,oe,ie,ue,se,ae,ce,pe,fe,de,le=(oe=void 0===(ne=(re=void 0===te?{}:te).connectHOC)?H:ne,ue=void 0===(ie=re.mapStateToPropsFactories)?[function(e){return"function"==typeof e?V(e):void 0},function(e){return e?void 0:Y(function(){return{}})}]:ie,ae=void 0===(se=re.mapDispatchToPropsFactories)?[function(e){return"function"==typeof e?V(e):void 0},function(e){return e?void 0:Y(function(e){return{dispatch:e}})},function(e){return e&&"object"==typeof e?Y(function(t){return r.bindActionCreators(e,t)}):void 0}]:se,pe=void 0===(ce=re.mergePropsFactories)?G:ce,de=void 0===(fe=re.selectorFactory)?X:fe,function(e,t,r,n){void 0===n&&(n={});var o=n.pure,i=void 0===o||o,u=n.areStatesEqual,s=void 0===u?ee:u,a=n.areOwnPropsEqual,c=void 0===a?K:a,p=n.areStatePropsEqual,f=void 0===p?K:p,d=n.areMergedPropsEqual,l=void 0===d?K:d,y=v(n,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),h=Z(e,ue,"mapStateToProps"),m=Z(t,ae,"mapDispatchToProps"),P=Z(r,pe,"mergeProps");return oe(de,b({methodName:"connect",getDisplayName:function(e){return"Connect("+e+")"},shouldHandleStateChanges:!!e,initMapStateToProps:h,initMapDispatchToProps:m,initMergeProps:P,pure:i,areStatesEqual:s,areOwnPropsEqual:c,areStatePropsEqual:f,areMergedPropsEqual:l},y))});function ye(){var e=t.useContext(p);return $(e,"could not find react-redux context value; please ensure the component is wrapped in a <Provider>"),e}function he(){return ye().store}function me(){return he().dispatch}function be(e,n){$(e,"You must pass actions to useActions");var o=me();return t.useMemo(function(){return Array.isArray(e)?e.map(function(e){return r.bindActionCreators(e,o)}):r.bindActionCreators(e,o)},n)}var ve="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;function Pe(e,r){$(e,"You must pass a selector to useSelectors");var n=ye(),o=n.store,i=n.subscription,u=t.useReducer(function(e){return e+1},0)[1],s=t.useMemo(function(){return new h(o,i)},[o,i]),a=t.useMemo(function(){return e},r),c=t.useRef(),p=t.useRef(a),f=void 0;try{f=a(o.getState())}catch(e){var d="An error occured while selecting the store state: "+e.message+".";throw c.current&&(d+="\nThe error may be correlated with this previous error:\n"+c.current.stack+"\n\nOriginal stack trace:"),Error(d)}var l=t.useRef(f);return ve(function(){p.current=a,l.current=f,c.current=void 0}),ve(function(){function e(){try{var e=p.current(o.getState());if(K(e,l.current))return;l.current=e}catch(e){c.current=e}u({})}return s.onStateChange=e,s.trySubscribe(),e(),function(){return s.tryUnsubscribe()}},[o,s]),f}f=n.unstable_batchedUpdates,Object.defineProperty(e,"batch",{enumerable:!0,get:function(){return n.unstable_batchedUpdates}}),e.Provider=m,e.ReactReduxContext=p,e.connect=le,e.connectAdvanced=H,e.useActions=be,e.useDispatch=me,e.useRedux=function(e,t){return[Pe(e),be(t)]},e.useSelector=Pe,e.useStore=he,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("redux"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","redux","react-dom"],t):t((e=e||self).ReactRedux={},e.React,e.Redux,e.ReactDOM)}(this,function(e,t,r,n){"use strict";var o="default"in t?t.default:t;function i(e,t){return e(t={exports:{}},t.exports),t.exports}var u="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";function s(){}function a(){}a.resetWarningCache=s;var c=i(function(e){e.exports=function(){function e(e,t,r,n,o,i){if(i!==u){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:s};return r.PropTypes=r,r}()}),p=o.createContext(null);var f=function(e){e()},d=function(){return f},l=null,y={notify:function(){}};var h=function(){function e(e,t){this.store=e,this.parentSub=t,this.unsubscribe=null,this.listeners=y,this.handleChangeWrapper=this.handleChangeWrapper.bind(this)}var t=e.prototype;return t.addNestedSub=function(e){return this.trySubscribe(),this.listeners.subscribe(e)},t.notifyNestedSubs=function(){this.listeners.notify()},t.handleChangeWrapper=function(){this.onStateChange&&this.onStateChange()},t.isSubscribed=function(){return!!this.unsubscribe},t.trySubscribe=function(){var e,t,r;this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.handleChangeWrapper):this.store.subscribe(this.handleChangeWrapper),this.listeners=(e=d(),t=[],r=[],{clear:function(){r=l,t=l},notify:function(){var n=t=r;e(function(){for(var e=0;n.length>e;e++)n[e]()})},get:function(){return r},subscribe:function(e){var n=!0;return r===t&&(r=t.slice()),r.push(e),function(){n&&t!==l&&(n=!1,r===t&&(r=t.slice()),r.splice(r.indexOf(e),1))}}}))},t.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=y)},e}(),m=function(e){var t,r;function n(t){var r;r=e.call(this,t)||this;var n=t.store;r.notifySubscribers=r.notifySubscribers.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r));var o=new h(n);return o.onStateChange=r.notifySubscribers,r.state={store:n,subscription:o},r.previousState=n.getState(),r}(t=n).prototype=Object.create((r=e).prototype),t.prototype.constructor=t,t.__proto__=r;var i=n.prototype;return i.componentDidMount=function(){this._isMounted=!0,this.state.subscription.trySubscribe(),this.previousState!==this.props.store.getState()&&this.state.subscription.notifyNestedSubs()},i.componentWillUnmount=function(){this.unsubscribe&&this.unsubscribe(),this.state.subscription.tryUnsubscribe(),this._isMounted=!1},i.componentDidUpdate=function(e){if(this.props.store!==e.store){this.state.subscription.tryUnsubscribe();var t=new h(this.props.store);t.onStateChange=this.notifySubscribers,this.setState({store:this.props.store,subscription:t})}},i.notifySubscribers=function(){this.state.subscription.notifyNestedSubs()},i.render=function(){return o.createElement((this.props.context||p).Provider,{value:this.state},this.props.children)},n}(t.Component);function b(){return(b=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function v(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;i.length>n;n++)0>t.indexOf(r=i[n])&&(o[r]=e[r]);return o}m.propTypes={store:c.shape({subscribe:c.func.isRequired,dispatch:c.func.isRequired,getState:c.func.isRequired}),context:c.object,children:c.any};var P,S=i(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&Symbol.for,n=r?Symbol.for("react.element"):60103,o=r?Symbol.for("react.portal"):60106,i=r?Symbol.for("react.fragment"):60107,u=r?Symbol.for("react.strict_mode"):60108,s=r?Symbol.for("react.profiler"):60114,a=r?Symbol.for("react.provider"):60109,c=r?Symbol.for("react.context"):60110,p=r?Symbol.for("react.async_mode"):60111,f=r?Symbol.for("react.concurrent_mode"):60111,d=r?Symbol.for("react.forward_ref"):60112,l=r?Symbol.for("react.suspense"):60113,y=r?Symbol.for("react.memo"):60115,h=r?Symbol.for("react.lazy"):60116;function m(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case p:case f:case i:case s:case u:case l:return e;default:switch(e=e&&e.$$typeof){case c:case d:case a:return e;default:return t}}case h:case y:case o:return t}}}function b(e){return m(e)===f}t.typeOf=m,t.AsyncMode=p,t.ConcurrentMode=f,t.ContextConsumer=c,t.ContextProvider=a,t.Element=n,t.ForwardRef=d,t.Fragment=i,t.Lazy=h,t.Memo=y,t.Portal=o,t.Profiler=s,t.StrictMode=u,t.Suspense=l,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===f||e===s||e===u||e===l||"object"==typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===y||e.$$typeof===a||e.$$typeof===c||e.$$typeof===d)},t.isAsyncMode=function(e){return b(e)||m(e)===p},t.isConcurrentMode=b,t.isContextConsumer=function(e){return m(e)===c},t.isContextProvider=function(e){return m(e)===a},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return m(e)===d},t.isFragment=function(e){return m(e)===i},t.isLazy=function(e){return m(e)===h},t.isMemo=function(e){return m(e)===y},t.isPortal=function(e){return m(e)===o},t.isProfiler=function(e){return m(e)===s},t.isStrictMode=function(e){return m(e)===u},t.isSuspense=function(e){return m(e)===l}});(P=S)&&P.__esModule&&Object.prototype.hasOwnProperty.call(P,"default");var g=i(function(e){e.exports=S}),O=g.isContextConsumer,w={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},C={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},x={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},R={};function M(e){return g.isMemo(e)?x:R[e.$$typeof]||w}R[g.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0};var E=Object.defineProperty,T=Object.getOwnPropertyNames,j=Object.getOwnPropertySymbols,_=Object.getOwnPropertyDescriptor,N=Object.getPrototypeOf,q=Object.prototype;var D=function e(t,r,n){if("string"!=typeof r){if(q){var o=N(r);o&&o!==q&&e(t,o,n)}var i=T(r);j&&(i=i.concat(j(r)));for(var u=M(t),s=M(r),a=0;i.length>a;++a){var c=i[a];if(!(C[c]||n&&n[c]||s&&s[c]||u&&u[c])){var p=_(r,c);try{E(t,c,p)}catch(e){}}}return t}return t},$=function(e,t,r,n,o,i,u,s){if(!e){var a;if(void 0===t)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[r,n,o,i,u,s],p=0;(a=Error(t.replace(/%s/g,function(){return c[p++]}))).name="Invariant Violation"}throw a.framesToPop=1,a}},A=[],F=[null,null];function U(e,t){return[t.payload,e[1]+1]}var W=function(){return[null,0]},k="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;function H(e,r){void 0===r&&(r={});var n=r.getDisplayName,i=void 0===n?function(e){return"ConnectAdvanced("+e+")"}:n,u=r.methodName,s=void 0===u?"connectAdvanced":u,a=r.renderCountProp,c=void 0===a?void 0:a,f=r.shouldHandleStateChanges,d=void 0===f||f,l=r.storeKey,y=void 0===l?"store":l,m=r.withRef,P=void 0!==m&&m,S=r.forwardRef,g=void 0!==S&&S,w=r.context,C=void 0===w?p:w,x=v(r,["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef","forwardRef","context"]);$(void 0===c,"renderCountProp is removed. render counting is built into the latest React Dev Tools profiling extension"),$(!P,"withRef is removed. To access the wrapped instance, use a ref on the connected component");$("store"===y,"storeKey has been removed and does not do anything. To use a custom Redux store for specific components, create a custom React context with React.createContext(), and pass the context object to React Redux's Provider and specific components like: <Provider context={MyContext}><ConnectedComponent context={MyContext} /></Provider>. You may also pass a {context : MyContext} option to connect");var R=C;return function(r){var n=r.displayName||r.name||"Component",u=i(n),a=b({},x,{getDisplayName:i,methodName:s,renderCountProp:c,shouldHandleStateChanges:d,storeKey:y,displayName:u,wrappedComponentName:n,WrappedComponent:r}),p=x.pure;var f=p?t.useMemo:function(e){return e()};function l(n){var i=t.useMemo(function(){return[n.context,n.forwardedRef,v(n,["context","forwardedRef"])]},[n]),s=i[0],c=i[1],p=i[2],l=t.useMemo(function(){return s&&s.Consumer&&O(o.createElement(s.Consumer,null))?s:R},[s,R]),y=t.useContext(l),m=!!n.store;$(m||!!y&&!!y.store,'Could not find "store" in the context of "'+u+'". Either wrap the root component in a <Provider>, or pass a custom React context provider to <Provider> and the corresponding React context consumer to '+u+" in connect options.");var P=n.store||y.store,S=t.useMemo(function(){return function(t){return e(t.dispatch,a)}(P)},[P]),g=t.useMemo(function(){if(!d)return F;var e=new h(P,m?null:y.subscription),t=e.notifyNestedSubs.bind(e);return[e,t]},[P,m,y]),w=g[0],C=g[1],x=t.useMemo(function(){return m?y:b({},y,{subscription:w})},[m,y,w]),M=t.useReducer(U,A,W),E=M[0][0],T=M[1];if(E&&E.error)throw E.error;var j=t.useRef(),_=t.useRef(p),N=t.useRef(),q=t.useRef(!1),D=f(function(){return N.current&&p===_.current?N.current:S(P.getState(),p)},[P,E,p]);k(function(){_.current=p,j.current=D,q.current=!1,N.current&&(N.current=null,C())}),k(function(){if(d){var e=!1,t=null,r=function(){if(!e){var r,n,o=P.getState();try{r=S(o,_.current)}catch(e){n=e,t=e}n||(t=null),r===j.current?q.current||C():(j.current=r,N.current=r,q.current=!0,T({type:"STORE_UPDATED",payload:{latestStoreState:o,error:n}}))}};w.onStateChange=r,w.trySubscribe(),r();return function(){if(e=!0,w.tryUnsubscribe(),t)throw t}}},[P,w,S]);var H=t.useMemo(function(){return o.createElement(r,b({},D,{ref:c}))},[c,r,D]);return t.useMemo(function(){return d?o.createElement(l.Provider,{value:x},H):H},[l,H,x])}var m=p?o.memo(l):l;if(m.WrappedComponent=r,m.displayName=u,g){var P=o.forwardRef(function(e,t){return o.createElement(m,b({},e,{forwardedRef:t}))});return P.displayName=u,P.WrappedComponent=r,D(P,r)}return D(m,r)}}var I=Object.prototype.hasOwnProperty;function L(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function K(e,t){if(L(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(var n=0;r.length>n;n++)if(!I.call(t,r[n])||!L(e[r[n]],t[r[n]]))return!1;return!0}function Y(e){return function(t,r){var n=e(t,r);function o(){return n}return o.dependsOnOwnProps=!1,o}}function z(e){return null!=e.dependsOnOwnProps?!!e.dependsOnOwnProps:1!==e.length}function V(e,t){return function(t,r){var n=function(e,t){return n.dependsOnOwnProps?n.mapToProps(e,t):n.mapToProps(e)};return n.dependsOnOwnProps=!0,n.mapToProps=function(t,r){n.mapToProps=e,n.dependsOnOwnProps=z(e);var o=n(t,r);return"function"==typeof o&&(n.mapToProps=o,n.dependsOnOwnProps=z(o),o=n(t,r)),o},n}}function B(e,t,r){return b({},r,e,t)}var G=[function(e){return"function"==typeof e?function(e){return function(t,r){var n,o=r.pure,i=r.areMergedPropsEqual,u=!1;return function(t,r,s){var a=e(t,r,s);return u?o&&i(a,n)||(n=a):(u=!0,n=a),n}}}(e):void 0},function(e){return e?void 0:function(){return B}}];function J(e,t,r,n){return function(o,i){return r(e(o,i),t(n,i),i)}}function Q(e,t,r,n,o){var i,u,s,a,c,p=o.areStatesEqual,f=o.areOwnPropsEqual,d=o.areStatePropsEqual,l=!1;function y(o,l){var y,h,m=!f(l,u),b=!p(o,i);return i=o,u=l,m&&b?(s=e(i,u),t.dependsOnOwnProps&&(a=t(n,u)),c=r(s,a,u)):m?(e.dependsOnOwnProps&&(s=e(i,u)),t.dependsOnOwnProps&&(a=t(n,u)),c=r(s,a,u)):b?(y=e(i,u),h=!d(y,s),s=y,h&&(c=r(s,a,u)),c):c}return function(o,p){return l?y(o,p):(s=e(i=o,u=p),a=t(n,u),c=r(s,a,u),l=!0,c)}}function X(e,t){var r=t.initMapStateToProps,n=t.initMapDispatchToProps,o=t.initMergeProps,i=v(t,["initMapStateToProps","initMapDispatchToProps","initMergeProps"]),u=r(e,i),s=n(e,i),a=o(e,i);return(i.pure?Q:J)(u,s,a,e,i)}function Z(e,t,r){for(var n=t.length-1;n>=0;n--){var o=t[n](e);if(o)return o}return function(t,n){throw Error("Invalid value of type "+typeof e+" for "+r+" argument when connecting component "+n.wrappedComponentName+".")}}function ee(e,t){return e===t}var te,re,ne,oe,ie,ue,se,ae,ce,pe,fe,de,le=(oe=void 0===(ne=(re=void 0===te?{}:te).connectHOC)?H:ne,ue=void 0===(ie=re.mapStateToPropsFactories)?[function(e){return"function"==typeof e?V(e):void 0},function(e){return e?void 0:Y(function(){return{}})}]:ie,ae=void 0===(se=re.mapDispatchToPropsFactories)?[function(e){return"function"==typeof e?V(e):void 0},function(e){return e?void 0:Y(function(e){return{dispatch:e}})},function(e){return e&&"object"==typeof e?Y(function(t){return r.bindActionCreators(e,t)}):void 0}]:se,pe=void 0===(ce=re.mergePropsFactories)?G:ce,de=void 0===(fe=re.selectorFactory)?X:fe,function(e,t,r,n){void 0===n&&(n={});var o=n.pure,i=void 0===o||o,u=n.areStatesEqual,s=void 0===u?ee:u,a=n.areOwnPropsEqual,c=void 0===a?K:a,p=n.areStatePropsEqual,f=void 0===p?K:p,d=n.areMergedPropsEqual,l=void 0===d?K:d,y=v(n,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),h=Z(e,ue,"mapStateToProps"),m=Z(t,ae,"mapDispatchToProps"),P=Z(r,pe,"mergeProps");return oe(de,b({methodName:"connect",getDisplayName:function(e){return"Connect("+e+")"},shouldHandleStateChanges:!!e,initMapStateToProps:h,initMapDispatchToProps:m,initMergeProps:P,pure:i,areStatesEqual:s,areOwnPropsEqual:c,areStatePropsEqual:f,areMergedPropsEqual:l},y))});function ye(){var e=t.useContext(p);return $(e,"could not find react-redux context value; please ensure the component is wrapped in a <Provider>"),e}function he(){return ye().store}function me(){return he().dispatch}var be="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;f=n.unstable_batchedUpdates,Object.defineProperty(e,"batch",{enumerable:!0,get:function(){return n.unstable_batchedUpdates}}),e.Provider=m,e.ReactReduxContext=p,e.connect=le,e.connectAdvanced=H,e.useActions=function(e,n){$(e,"You must pass actions to useActions");var o=me();return t.useMemo(function(){return Array.isArray(e)?e.map(function(e){return r.bindActionCreators(e,o)}):r.bindActionCreators(e,o)},n)},e.useDispatch=me,e.useSelector=function(e,r){$(e,"You must pass a selector to useSelectors");var n=ye(),o=n.store,i=n.subscription,u=t.useReducer(function(e){return e+1},0)[1],s=t.useMemo(function(){return new h(o,i)},[o,i]),a=t.useMemo(function(){return e},r),c=t.useRef(),p=t.useRef(a),f=void 0;try{f=a(o.getState())}catch(e){var d="An error occured while selecting the store state: "+e.message+".";throw c.current&&(d+="\nThe error may be correlated with this previous error:\n"+c.current.stack+"\n\nOriginal stack trace:"),Error(d)}var l=t.useRef(f);return be(function(){p.current=a,l.current=f,c.current=void 0}),be(function(){function e(){try{var e=p.current(o.getState());if(K(e,l.current))return;l.current=e}catch(e){c.current=e}u({})}return s.onStateChange=e,s.trySubscribe(),e(),function(){return s.tryUnsubscribe()}},[o,s]),f},e.useStore=he,Object.defineProperty(e,"__esModule",{value:!0})});

@@ -7,3 +7,2 @@ import Provider from './components/Provider';

import { useDispatch } from './hooks/useDispatch';
import { useRedux } from './hooks/useRedux';
import { useSelector } from './hooks/useSelector';

@@ -14,2 +13,2 @@ import { useStore } from './hooks/useStore';

var batch = getBatch();
export { Provider, connectAdvanced, ReactReduxContext, connect, batch, useActions, useDispatch, useRedux, useSelector, useStore };
export { Provider, connectAdvanced, ReactReduxContext, connect, batch, useActions, useDispatch, useSelector, useStore };

@@ -195,2 +195,3 @@ import _extends from "@babel/runtime/helpers/esm/extends";

var childPropsFromStoreUpdate = useRef();
var renderIsScheduled = useRef(false);
var actualChildProps = usePureOnlyMemo(function () {

@@ -219,3 +220,4 @@ // Tricky logic here:

lastWrapperProps.current = wrapperProps;
lastChildProps.current = actualChildProps; // If the render was from a store update, clear out that reference and cascade the subscriber update
lastChildProps.current = actualChildProps;
renderIsScheduled.current = false; // If the render was from a store update, clear out that reference and cascade the subscriber update

@@ -260,3 +262,5 @@ if (childPropsFromStoreUpdate.current) {

if (newChildProps === lastChildProps.current) {
notifyNestedSubs();
if (!renderIsScheduled.current) {
notifyNestedSubs();
}
} else {

@@ -268,3 +272,4 @@ // Save references to the new child props. Note that we track the "child props from store update"

lastChildProps.current = newChildProps;
childPropsFromStoreUpdate.current = newChildProps; // If the child props _did_ change (or we caught an error), this wrapper component needs to re-render
childPropsFromStoreUpdate.current = newChildProps;
renderIsScheduled.current = true; // If the child props _did_ change (or we caught an error), this wrapper component needs to re-render

@@ -271,0 +276,0 @@ forceComponentUpdateDispatch({

@@ -8,55 +8,53 @@ import { bindActionCreators } from 'redux';

* similar to how redux's `bindActionCreators` works.
*
*
* Supports passing a single action creator, an array/tuple of action
* creators, or an object of action creators.
*
*
* Any arguments passed to the created callbacks are passed through to
* the your functions.
*
* your functions.
*
* This hook takes a dependencies array as an optional second argument,
* which when passed ensures referential stability of the created callbacks.
*
*
* @param {Function|Function[]|Object.<string, Function>} actions the action creators to bind
* @param {any[]} deps (optional) dependencies array to control referential stability
*
*
* @returns {Function|Function[]|Object.<string, Function>} callback(s) bound to store's `dispatch` function
*
* Usage:
* @example
*
```jsx
import React from 'react'
import { useActions } from 'react-redux'
const increaseCounter = ({ amount }) => ({
type: 'increase-counter',
amount,
})
export const CounterComponent = ({ value }) => {
// supports passing an object of action creators
const { increaseCounterByOne, increaseCounterByTwo } = useActions({
increaseCounterByOne: () => increaseCounter(1),
increaseCounterByTwo: () => increaseCounter(2),
}, [])
// supports passing an array/tuple of action creators
const [increaseCounterByThree, increaseCounterByFour] = useActions([
() => increaseCounter(3),
() => increaseCounter(4),
], [])
// supports passing a single action creator
const increaseCounterBy5 = useActions(() => increaseCounter(5), [])
// passes through any arguments to the callback
const increaseCounterByX = useActions(x => increaseCounter(x), [])
return (
<div>
<span>{value}</span>
<button onClick={increaseCounterByOne}>Increase counter by 1</button>
</div>
)
}
```
* import React from 'react'
* import { useActions } from 'react-redux'
*
* const increaseCounter = amount => ({
* type: 'increase-counter',
* amount,
* })
*
* export const CounterComponent = ({ value }) => {
* // supports passing an object of action creators
* const { increaseCounterByOne, increaseCounterByTwo } = useActions({
* increaseCounterByOne: () => increaseCounter(1),
* increaseCounterByTwo: () => increaseCounter(2),
* }, [])
*
* // supports passing an array/tuple of action creators
* const [increaseCounterByThree, increaseCounterByFour] = useActions([
* () => increaseCounter(3),
* () => increaseCounter(4),
* ], [])
*
* // supports passing a single action creator
* const increaseCounterBy5 = useActions(() => increaseCounter(5), [])
*
* // passes through any arguments to the callback
* const increaseCounterByX = useActions(x => increaseCounter(x), [])
*
* return (
* <div>
* <span>{value}</span>
* <button onClick={increaseCounterByOne}>Increase counter by 1</button>
* </div>
* )
* }
*/

@@ -63,0 +61,0 @@

@@ -6,22 +6,20 @@ import { useStore } from './useStore';

* action creators to the `dispatch` function.
*
*
* @returns {any} redux store's `dispatch` function
*
* Usage:
* @example
*
```jsx
import React, { useCallback } from 'react'
import { useReduxDispatch } from 'react-redux'
export const CounterComponent = ({ value }) => {
const dispatch = useDispatch()
const increaseCounter = useCallback(() => dispatch({ type: 'increase-counter' }), [])
return (
<div>
<span>{value}</span>
<button onClick={increaseCounter}>Increase counter</button>
</div>
)
}
```
* import React, { useCallback } from 'react'
* import { useReduxDispatch } from 'react-redux'
*
* export const CounterComponent = ({ value }) => {
* const dispatch = useDispatch()
* const increaseCounter = useCallback(() => dispatch({ type: 'increase-counter' }), [])
* return (
* <div>
* <span>{value}</span>
* <button onClick={increaseCounter}>Increase counter</button>
* </div>
* )
* }
*/

@@ -28,0 +26,0 @@

@@ -7,16 +7,14 @@ import { useContext } from 'react';

* hook that you should usually not need to call directly.
*
*
* @returns {any} the value of the `ReactReduxContext`
*
* Usage:
* @example
*
```jsx
import React from 'react'
import { useReduxContext } from 'react-redux'
export const CounterComponent = ({ value }) => {
const { store } = useReduxContext()
return <div>{store.getState()}</div>
}
```
* import React from 'react'
* import { useReduxContext } from 'react-redux'
*
* export const CounterComponent = ({ value }) => {
* const { store } = useReduxContext()
* return <div>{store.getState()}</div>
* }
*/

@@ -23,0 +21,0 @@

@@ -22,20 +22,19 @@ import { useReducer, useRef, useEffect, useMemo, useLayoutEffect } from 'react';

* useful if you provide a selector that memoizes values).
*
*
* @param {Function} selector the selector function
* @param {any[]} deps (optional) dependencies array to control referential stability
* of the selector
*
*
* @returns {any} the selected state
*
* Usage:
* @example
*
```jsx
import React from 'react'
import { useSelector } from 'react-redux'
export const CounterComponent = () => {
const counter = useSelector(state => state.counter)
return <div>{counter}</div>
}
```
* import React from 'react'
* import { useSelector } from 'react-redux'
* import { RootState } from './store'
*
* export const CounterComponent = () => {
* const counter = useSelector(state => state.counter, [])
* return <div>{counter}</div>
* }
*/

@@ -42,0 +41,0 @@

import { useReduxContext } from './useReduxContext';
/**
* A hook to access the redux store.
*
*
* @returns {any} the redux store
*
* Usage:
* @example
*
```jsx
import React from 'react'
import { useStore } from 'react-redux'
export const CounterComponent = ({ value }) => {
const store = useStore()
return <div>{store.getState()}</div>
}
```
* import React from 'react'
* import { useStore } from 'react-redux'
*
* export const ExampleComponent = () => {
* const store = useStore()
* return <div>{store.getState()}</div>
* }
*/

@@ -19,0 +17,0 @@

@@ -7,3 +7,2 @@ import Provider from './components/Provider';

import { useDispatch } from './hooks/useDispatch';
import { useRedux } from './hooks/useRedux';
import { useSelector } from './hooks/useSelector';

@@ -14,2 +13,2 @@ import { useStore } from './hooks/useStore';

setBatch(batch);
export { Provider, connectAdvanced, ReactReduxContext, connect, batch, useActions, useDispatch, useRedux, useSelector, useStore };
export { Provider, connectAdvanced, ReactReduxContext, connect, batch, useActions, useDispatch, useSelector, useStore };

@@ -32,6 +32,2 @@ "use strict";

var _useRedux = require("./hooks/useRedux");
exports.useRedux = _useRedux.useRedux;
var _useSelector = require("./hooks/useSelector");

@@ -38,0 +34,0 @@

@@ -209,2 +209,3 @@ "use strict";

var childPropsFromStoreUpdate = (0, _react.useRef)();
var renderIsScheduled = (0, _react.useRef)(false);
var actualChildProps = usePureOnlyMemo(function () {

@@ -233,3 +234,4 @@ // Tricky logic here:

lastWrapperProps.current = wrapperProps;
lastChildProps.current = actualChildProps; // If the render was from a store update, clear out that reference and cascade the subscriber update
lastChildProps.current = actualChildProps;
renderIsScheduled.current = false; // If the render was from a store update, clear out that reference and cascade the subscriber update

@@ -274,3 +276,5 @@ if (childPropsFromStoreUpdate.current) {

if (newChildProps === lastChildProps.current) {
notifyNestedSubs();
if (!renderIsScheduled.current) {
notifyNestedSubs();
}
} else {

@@ -282,3 +286,4 @@ // Save references to the new child props. Note that we track the "child props from store update"

lastChildProps.current = newChildProps;
childPropsFromStoreUpdate.current = newChildProps; // If the child props _did_ change (or we caught an error), this wrapper component needs to re-render
childPropsFromStoreUpdate.current = newChildProps;
renderIsScheduled.current = true; // If the child props _did_ change (or we caught an error), this wrapper component needs to re-render

@@ -285,0 +290,0 @@ forceComponentUpdateDispatch({

@@ -19,55 +19,53 @@ "use strict";

* similar to how redux's `bindActionCreators` works.
*
*
* Supports passing a single action creator, an array/tuple of action
* creators, or an object of action creators.
*
*
* Any arguments passed to the created callbacks are passed through to
* the your functions.
*
* your functions.
*
* This hook takes a dependencies array as an optional second argument,
* which when passed ensures referential stability of the created callbacks.
*
*
* @param {Function|Function[]|Object.<string, Function>} actions the action creators to bind
* @param {any[]} deps (optional) dependencies array to control referential stability
*
*
* @returns {Function|Function[]|Object.<string, Function>} callback(s) bound to store's `dispatch` function
*
* Usage:
* @example
*
```jsx
import React from 'react'
import { useActions } from 'react-redux'
const increaseCounter = ({ amount }) => ({
type: 'increase-counter',
amount,
})
export const CounterComponent = ({ value }) => {
// supports passing an object of action creators
const { increaseCounterByOne, increaseCounterByTwo } = useActions({
increaseCounterByOne: () => increaseCounter(1),
increaseCounterByTwo: () => increaseCounter(2),
}, [])
// supports passing an array/tuple of action creators
const [increaseCounterByThree, increaseCounterByFour] = useActions([
() => increaseCounter(3),
() => increaseCounter(4),
], [])
// supports passing a single action creator
const increaseCounterBy5 = useActions(() => increaseCounter(5), [])
// passes through any arguments to the callback
const increaseCounterByX = useActions(x => increaseCounter(x), [])
return (
<div>
<span>{value}</span>
<button onClick={increaseCounterByOne}>Increase counter by 1</button>
</div>
)
}
```
* import React from 'react'
* import { useActions } from 'react-redux'
*
* const increaseCounter = amount => ({
* type: 'increase-counter',
* amount,
* })
*
* export const CounterComponent = ({ value }) => {
* // supports passing an object of action creators
* const { increaseCounterByOne, increaseCounterByTwo } = useActions({
* increaseCounterByOne: () => increaseCounter(1),
* increaseCounterByTwo: () => increaseCounter(2),
* }, [])
*
* // supports passing an array/tuple of action creators
* const [increaseCounterByThree, increaseCounterByFour] = useActions([
* () => increaseCounter(3),
* () => increaseCounter(4),
* ], [])
*
* // supports passing a single action creator
* const increaseCounterBy5 = useActions(() => increaseCounter(5), [])
*
* // passes through any arguments to the callback
* const increaseCounterByX = useActions(x => increaseCounter(x), [])
*
* return (
* <div>
* <span>{value}</span>
* <button onClick={increaseCounterByOne}>Increase counter by 1</button>
* </div>
* )
* }
*/

@@ -74,0 +72,0 @@ function useActions(actions, deps) {

@@ -12,22 +12,20 @@ "use strict";

* action creators to the `dispatch` function.
*
*
* @returns {any} redux store's `dispatch` function
*
* Usage:
* @example
*
```jsx
import React, { useCallback } from 'react'
import { useReduxDispatch } from 'react-redux'
export const CounterComponent = ({ value }) => {
const dispatch = useDispatch()
const increaseCounter = useCallback(() => dispatch({ type: 'increase-counter' }), [])
return (
<div>
<span>{value}</span>
<button onClick={increaseCounter}>Increase counter</button>
</div>
)
}
```
* import React, { useCallback } from 'react'
* import { useReduxDispatch } from 'react-redux'
*
* export const CounterComponent = ({ value }) => {
* const dispatch = useDispatch()
* const increaseCounter = useCallback(() => dispatch({ type: 'increase-counter' }), [])
* return (
* <div>
* <span>{value}</span>
* <button onClick={increaseCounter}>Increase counter</button>
* </div>
* )
* }
*/

@@ -34,0 +32,0 @@ function useDispatch() {

@@ -17,16 +17,14 @@ "use strict";

* hook that you should usually not need to call directly.
*
*
* @returns {any} the value of the `ReactReduxContext`
*
* Usage:
* @example
*
```jsx
import React from 'react'
import { useReduxContext } from 'react-redux'
export const CounterComponent = ({ value }) => {
const { store } = useReduxContext()
return <div>{store.getState()}</div>
}
```
* import React from 'react'
* import { useReduxContext } from 'react-redux'
*
* export const CounterComponent = ({ value }) => {
* const { store } = useReduxContext()
* return <div>{store.getState()}</div>
* }
*/

@@ -33,0 +31,0 @@ function useReduxContext() {

@@ -34,20 +34,19 @@ "use strict";

* useful if you provide a selector that memoizes values).
*
*
* @param {Function} selector the selector function
* @param {any[]} deps (optional) dependencies array to control referential stability
* of the selector
*
*
* @returns {any} the selected state
*
* Usage:
* @example
*
```jsx
import React from 'react'
import { useSelector } from 'react-redux'
export const CounterComponent = () => {
const counter = useSelector(state => state.counter)
return <div>{counter}</div>
}
```
* import React from 'react'
* import { useSelector } from 'react-redux'
* import { RootState } from './store'
*
* export const CounterComponent = () => {
* const counter = useSelector(state => state.counter, [])
* return <div>{counter}</div>
* }
*/

@@ -54,0 +53,0 @@

@@ -10,16 +10,14 @@ "use strict";

* A hook to access the redux store.
*
*
* @returns {any} the redux store
*
* Usage:
* @example
*
```jsx
import React from 'react'
import { useStore } from 'react-redux'
export const CounterComponent = ({ value }) => {
const store = useStore()
return <div>{store.getState()}</div>
}
```
* import React from 'react'
* import { useStore } from 'react-redux'
*
* export const ExampleComponent = () => {
* const store = useStore()
* return <div>{store.getState()}</div>
* }
*/

@@ -26,0 +24,0 @@ function useStore() {

@@ -31,6 +31,2 @@ "use strict";

var _useRedux = require("./hooks/useRedux");
exports.useRedux = _useRedux.useRedux;
var _useSelector = require("./hooks/useSelector");

@@ -37,0 +33,0 @@

{
"name": "react-redux",
"version": "7.1.0-alpha.1",
"version": "7.1.0-alpha.2",
"description": "Official React bindings for Redux",

@@ -77,2 +77,4 @@ "keywords": [

"react-dom": "^16.8.6",
"react-hooks-testing-library": "^0.5.0",
"react-test-renderer": "^16.8.6",
"react-testing-library": "^5.9.0",

@@ -79,0 +81,0 @@ "redux": "^4.0.1",

@@ -8,3 +8,2 @@ import Provider from './components/Provider'

import { useDispatch } from './hooks/useDispatch'
import { useRedux } from './hooks/useRedux'
import { useSelector } from './hooks/useSelector'

@@ -26,5 +25,4 @@ import { useStore } from './hooks/useStore'

useDispatch,
useRedux,
useSelector,
useStore
}

@@ -256,2 +256,3 @@ import hoistStatics from 'hoist-non-react-statics'

const childPropsFromStoreUpdate = useRef()
const renderIsScheduled = useRef(false)

@@ -286,2 +287,3 @@ const actualChildProps = usePureOnlyMemo(() => {

lastChildProps.current = actualChildProps
renderIsScheduled.current = false

@@ -333,3 +335,5 @@ // If the render was from a store update, clear out that reference and cascade the subscriber update

if (newChildProps === lastChildProps.current) {
notifyNestedSubs()
if (!renderIsScheduled.current) {
notifyNestedSubs()
}
} else {

@@ -342,2 +346,3 @@ // Save references to the new child props. Note that we track the "child props from store update"

childPropsFromStoreUpdate.current = newChildProps
renderIsScheduled.current = true

@@ -344,0 +349,0 @@ // If the child props _did_ change (or we caught an error), this wrapper component needs to re-render

@@ -9,55 +9,53 @@ import { bindActionCreators } from 'redux'

* similar to how redux's `bindActionCreators` works.
*
*
* Supports passing a single action creator, an array/tuple of action
* creators, or an object of action creators.
*
*
* Any arguments passed to the created callbacks are passed through to
* the your functions.
*
* your functions.
*
* This hook takes a dependencies array as an optional second argument,
* which when passed ensures referential stability of the created callbacks.
*
*
* @param {Function|Function[]|Object.<string, Function>} actions the action creators to bind
* @param {any[]} deps (optional) dependencies array to control referential stability
*
*
* @returns {Function|Function[]|Object.<string, Function>} callback(s) bound to store's `dispatch` function
*
* Usage:
* @example
*
```jsx
import React from 'react'
import { useActions } from 'react-redux'
const increaseCounter = ({ amount }) => ({
type: 'increase-counter',
amount,
})
export const CounterComponent = ({ value }) => {
// supports passing an object of action creators
const { increaseCounterByOne, increaseCounterByTwo } = useActions({
increaseCounterByOne: () => increaseCounter(1),
increaseCounterByTwo: () => increaseCounter(2),
}, [])
// supports passing an array/tuple of action creators
const [increaseCounterByThree, increaseCounterByFour] = useActions([
() => increaseCounter(3),
() => increaseCounter(4),
], [])
// supports passing a single action creator
const increaseCounterBy5 = useActions(() => increaseCounter(5), [])
// passes through any arguments to the callback
const increaseCounterByX = useActions(x => increaseCounter(x), [])
return (
<div>
<span>{value}</span>
<button onClick={increaseCounterByOne}>Increase counter by 1</button>
</div>
)
}
```
* import React from 'react'
* import { useActions } from 'react-redux'
*
* const increaseCounter = amount => ({
* type: 'increase-counter',
* amount,
* })
*
* export const CounterComponent = ({ value }) => {
* // supports passing an object of action creators
* const { increaseCounterByOne, increaseCounterByTwo } = useActions({
* increaseCounterByOne: () => increaseCounter(1),
* increaseCounterByTwo: () => increaseCounter(2),
* }, [])
*
* // supports passing an array/tuple of action creators
* const [increaseCounterByThree, increaseCounterByFour] = useActions([
* () => increaseCounter(3),
* () => increaseCounter(4),
* ], [])
*
* // supports passing a single action creator
* const increaseCounterBy5 = useActions(() => increaseCounter(5), [])
*
* // passes through any arguments to the callback
* const increaseCounterByX = useActions(x => increaseCounter(x), [])
*
* return (
* <div>
* <span>{value}</span>
* <button onClick={increaseCounterByOne}>Increase counter by 1</button>
* </div>
* )
* }
*/

@@ -64,0 +62,0 @@ export function useActions(actions, deps) {

@@ -7,22 +7,20 @@ import { useStore } from './useStore'

* action creators to the `dispatch` function.
*
*
* @returns {any} redux store's `dispatch` function
*
* Usage:
* @example
*
```jsx
import React, { useCallback } from 'react'
import { useReduxDispatch } from 'react-redux'
export const CounterComponent = ({ value }) => {
const dispatch = useDispatch()
const increaseCounter = useCallback(() => dispatch({ type: 'increase-counter' }), [])
return (
<div>
<span>{value}</span>
<button onClick={increaseCounter}>Increase counter</button>
</div>
)
}
```
* import React, { useCallback } from 'react'
* import { useReduxDispatch } from 'react-redux'
*
* export const CounterComponent = ({ value }) => {
* const dispatch = useDispatch()
* const increaseCounter = useCallback(() => dispatch({ type: 'increase-counter' }), [])
* return (
* <div>
* <span>{value}</span>
* <button onClick={increaseCounter}>Increase counter</button>
* </div>
* )
* }
*/

@@ -29,0 +27,0 @@ export function useDispatch() {

@@ -8,16 +8,14 @@ import { useContext } from 'react'

* hook that you should usually not need to call directly.
*
*
* @returns {any} the value of the `ReactReduxContext`
*
* Usage:
* @example
*
```jsx
import React from 'react'
import { useReduxContext } from 'react-redux'
export const CounterComponent = ({ value }) => {
const { store } = useReduxContext()
return <div>{store.getState()}</div>
}
```
* import React from 'react'
* import { useReduxContext } from 'react-redux'
*
* export const CounterComponent = ({ value }) => {
* const { store } = useReduxContext()
* return <div>{store.getState()}</div>
* }
*/

@@ -24,0 +22,0 @@ export function useReduxContext() {

@@ -25,20 +25,19 @@ import { useReducer, useRef, useEffect, useMemo, useLayoutEffect } from 'react'

* useful if you provide a selector that memoizes values).
*
*
* @param {Function} selector the selector function
* @param {any[]} deps (optional) dependencies array to control referential stability
* of the selector
*
*
* @returns {any} the selected state
*
* Usage:
* @example
*
```jsx
import React from 'react'
import { useSelector } from 'react-redux'
export const CounterComponent = () => {
const counter = useSelector(state => state.counter)
return <div>{counter}</div>
}
```
* import React from 'react'
* import { useSelector } from 'react-redux'
* import { RootState } from './store'
*
* export const CounterComponent = () => {
* const counter = useSelector(state => state.counter, [])
* return <div>{counter}</div>
* }
*/

@@ -45,0 +44,0 @@ export function useSelector(selector, deps) {

@@ -5,16 +5,14 @@ import { useReduxContext } from './useReduxContext'

* A hook to access the redux store.
*
*
* @returns {any} the redux store
*
* Usage:
* @example
*
```jsx
import React from 'react'
import { useStore } from 'react-redux'
export const CounterComponent = ({ value }) => {
const store = useStore()
return <div>{store.getState()}</div>
}
```
* import React from 'react'
* import { useStore } from 'react-redux'
*
* export const ExampleComponent = () => {
* const store = useStore()
* return <div>{store.getState()}</div>
* }
*/

@@ -21,0 +19,0 @@ export function useStore() {

@@ -8,3 +8,2 @@ import Provider from './components/Provider'

import { useDispatch } from './hooks/useDispatch'
import { useRedux } from './hooks/useRedux'
import { useSelector } from './hooks/useSelector'

@@ -26,5 +25,4 @@ import { useStore } from './hooks/useStore'

useDispatch,
useRedux,
useSelector,
useStore
}

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc