MCPcopy Create free account
hub / github.com/WebReflection/neverland / useReducer

Function useReducer

test/neverland.js:524–531  ·  view source on GitHub ↗
(reducer, value, init, options)

Source from the content-addressed store, hash-verified

522
523 /*! (c) Andrea Giammarchi - ISC */
524 var useReducer = function useReducer(reducer, value, init, options) {
525 var fn = typeof init === 'function'; // avoid `cons [state, update] = ...` Babel destructuring bloat
526
527 var pair = useState(fn ? init(value) : value, fn ? options : init);
528 return [pair[0], function (value) {
529 pair[1](reducer(pair[0], value));
530 }];
531 };
532
533 /*! (c) Andrea Giammarchi - ISC */
534 var useRef = function useRef(value) {

Callers 1

test.jsFile · 0.70

Calls 2

reducerFunction · 0.85
useStateFunction · 0.70

Tested by

no test coverage detected