Show HN: I created redux-lite: easy-use, high-performance React state manager
I'd like to share a project I've been working on: `@oldbig/redux-lite`. It's a state management library for React designed to be:
1. *High-Performance & Lightweight*: Zero runtime dependencies, a tiny footprint, and built-in optimizations to prevent unnecessary re-renders. It's incredibly fast. 2. *Super Easy to Learn & Use*: The API is so simple you can learn it in 5 minutes. It eliminates boilerplate by generating everything from a single store definition. 3. *Extremely Easy to Test*: Since the state is just a plain object and there are no complex reducers to mock, writing unit tests for your components is trivial. 4. *Fully Type-Safe*: End-to-end type safety with excellent autocompletion.
Here’s a quick look at the API:
// 1. Define your store const storeDefinition = { user: { name: 'Guest', age: 0 }, tasks: optional<string[]>(), // Optional state slices };
// 2. Initiate const { ReduxLiteProvider, useReduxLiteStore } = initiate(storeDefinition);
// 3. Use the hook in your component const { user, dispatchPartialUser } = useReduxLiteStore(); // dispatchPartialUser({ name: 'John' });
The library is designed to prevent unnecessary re-renders by performing deep equality checks on state updates.
GitHub Repo: https://github.com/oldbig/redux-lite NPM Package: https://www.npmjs.com/package/@oldbig/redux-lite Demo (Todo List): https://github.com/oldbig/redux-lite/tree/main/examples/todo...
I built this because I wanted a state manager that was powerful without the complexity and boilerplate of traditional Redux. I'd love to get your feedback and answer any questions. Thanks for checking it out!