RE

Reselect

reselect

Selectors for Redux.

State Management
react
redux
reselect
State Management
javascript
npm
frontend
open source
ui
library
Stars
19k
Weekly
44M
Open issues
41
Bundle
~15 kB

Installation

npm install reselect

Code example

import { create } from "reselect";

const useStore = create((set) => ({
  count: 0,
  inc: () => set((s) => ({ count: s.count + 1 })),
}));

export function Example() {
  const { count, inc } = useStore();
  return (
    <button type="button" onClick={inc}>
      Count: {count}
    </button>
  );
}

Pros & cons

Pros

  • Actively maintained by gaearon
  • 44M weekly downloads. Battle tested
  • First-class TypeScript definitions
  • MIT licensed

Considerations

  • Adds roughly ~15 kB to your bundle
  • Needs client-only rendering in SSR frameworks
  • Not supported in React Native
  • 41 open issues on GitHub

FAQs

Alternatives & similar libraries