hardReact#146

createSelector with memoization

Prompt

Implement Reselect's core: createSelector(inputSelectors, combiner):

  1. Returns selector(state) that runs each input selector, then combiner(...inputResults)
  2. If every input result is reference-equal (===) to last time, return the cached combiner result WITHOUT calling the combiner
  3. Cache size 1 (like Reselect's default)

Hints

Solution

Your Code

20 min

Tests

Click Run to test your code