Vegetarian friendly state for React
See the code
Vegetarian friendly state for React
v7 Beta — this release modernises Easy Peasy around React 19's concurrent primitives. The public store/model API is unchanged from v6 and the library is feature-complete, but the v7 line is still in beta — APIs may shift in response to feedback before the stable release. See the v6 → v7 upgrade guide for details, or view the v6 docs for the current stable release.
Easy Peasy is an abstraction of Redux, providing a reimagined API that focuses on developer experience. It allows you to quickly and easily manage your state, whilst leveraging the strong architectural guarantees and extensive eco-system that Redux has to offer.
All of this comes via a single dependency install. While v7 is in beta it is
published under the beta dist-tag — the latest tag will move to v7 once the
stable release ships.
npm install easy-peasy@beta
Create your store
const store = createStore({
todos: ['Create store', 'Wrap application', 'Use store'],
addTodo: action((state, payload) => {
state.todos.push(payload);
}),
});
Wrap your application
function App() {
return (
<StoreProvider store={store}>
<TodoList />
</StoreProvider>
);
}
Use the store
function TodoList() {
const todos = useStoreState((state) => state.todos);
const addTodo = useStoreActions((actions) => actions.addTodo);
return (
<div>
{todos.map((todo, idx) => (
<div key={idx}>{todo}</div>
))}
<AddTodo onAdd={addTodo} />
</div>
);
}
See the example folder for more examples of how to use
easy-peasy.
We have only but great appreciation to those who support this project. If you have the ability to help contribute towards the continued maintenance and evolution of this library then please consider [becoming a sponsor].
See the official website for tutorials, docs, recipes, and more.
Overall
Maintained
Code review
npm
Latest release
Releases this year
(top 24 of 27)
17,405 followers · starred Nov 2018
276 followers · starred Oct 2020
164 followers · starred Dec 2019
512 followers · starred Dec 2024
Vegetarian friendly state for React
See the code
Vegetarian friendly state for React
v7 Beta — this release modernises Easy Peasy around React 19's concurrent primitives. The public store/model API is unchanged from v6 and the library is feature-complete, but the v7 line is still in beta — APIs may shift in response to feedback before the stable release. See the v6 → v7 upgrade guide for details, or view the v6 docs for the current stable release.
Easy Peasy is an abstraction of Redux, providing a reimagined API that focuses on developer experience. It allows you to quickly and easily manage your state, whilst leveraging the strong architectural guarantees and extensive eco-system that Redux has to offer.
All of this comes via a single dependency install. While v7 is in beta it is
published under the beta dist-tag — the latest tag will move to v7 once the
stable release ships.
npm install easy-peasy@beta
Create your store
const store = createStore({
todos: ['Create store', 'Wrap application', 'Use store'],
addTodo: action((state, payload) => {
state.todos.push(payload);
}),
});
Wrap your application
function App() {
return (
<StoreProvider store={store}>
<TodoList />
</StoreProvider>
);
}
Use the store
function TodoList() {
const todos = useStoreState((state) => state.todos);
const addTodo = useStoreActions((actions) => actions.addTodo);
return (
<div>
{todos.map((todo, idx) => (
<div key={idx}>{todo}</div>
))}
<AddTodo onAdd={addTodo} />
</div>
);
}
See the example folder for more examples of how to use
easy-peasy.
We have only but great appreciation to those who support this project. If you have the ability to help contribute towards the continued maintenance and evolution of this library then please consider [becoming a sponsor].
See the official website for tutorials, docs, recipes, and more.
Overall
Maintained
Code review
npm
Latest release
Releases this year
(top 24 of 27)
17,405 followers · starred Nov 2018
276 followers · starred Oct 2020
164 followers · starred Dec 2019
512 followers · starred Dec 2024