logged-selector

1.0.0 • Public • Published

Description

Custom reselect selector with the ability to log all recomputations with the output similar to redux-logger

Inspired by https://github.com/kbrownlees/reselect-change-memoize and https://github.com/LogRocket/redux-logger

Usage

Standard reselect use case example:

import { createSelector } from 'reselect';
 
const shopItemsSelector = state => state.shop.items
const taxPercentSelector = state => state.shop.taxPercent
 
const subtotalSelector = createSelector(
  shopItemsSelector,
  items => items.reduce((acc, item) => acc + item.value, 0)
)

With logged selector:

import createLoggedSelector from 'logged-selector';
 
const shopItemsSelector = state => state.shop.items
const taxPercentSelector = state => state.shop.taxPercent
 
const subtotalSelector = createLoggedSelector(
  'subtotalSelector',
  shopItemsSelector,
  items => items.reduce((acc, item) => acc + item.value, 0)
)

Package Sidebar

Install

npm i logged-selector

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

10.2 kB

Total Files

9

Last publish

Collaborators

  • adeonmaster