Skip to content

4.1.0

Compare
Choose a tag to compare
@RichardLindhout RichardLindhout released this 29 Jun 20:23
· 89 commits to main since this release

Added useSelector hook + tests
Added optional callbacks to setState inside hooks

// if you only want to subscribe to part of your state (this example the first product)
const cartProducts = cartProductsState.useSelector((state) => state[0]);

// custom comparison function (only use this if you have heavy child components and the default === comparison is not efficient enough)
const cartProducts = cartProductsState.useSelector(
  (state) => state[0],
  (a, b) => JSON.stringify(a) === JSON.stringify(b)
);