Inside of the react-redux library, in the file defining useSelector, I have found multiple instances of comma operators used with IIFEs in the follow manner:
var _useReducer = (0, _react.useReducer)(function (s) {
return s + 1;
}, 0),
forceRender = _useReducer[1];
var subscription = (0, _react.useMemo)(function () {
return (0, _Subscription.createSubscription)(store, contextSub);
}, [store, contextSub]);
var latestSubscriptionCallbackError = (0, _react.useRef)();
var latestSelector = (0, _react.useRef)();
var latestStoreState = (0, _react.useRef)();
var latestSelectedState = (0, _react.useRef)();
I can't understand or find any reference as to why they are using 0 inside of the IIFEs.
In the context of the comma operator, each value is evaluated and only the last expression is assigned to the variable.
In my eyes and to my understanding, the 0s are meaningless. Can someone explain them?