Vegetarian friendly state for React
npm install easy-peasy
Vegetarian friendly state for React
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.
npm install easy-peasy
`
Fly like an eagle 🦅
Create your store
`javascript
const store = createStore({
todos: ['Create store', 'Wrap application', 'Use store'],
addTodo: action((state, payload) => {
state.todos.push(payload);
}),
});
`
Wrap your application
`javascript
function App() {
return (
);
}
`
Use the store
`javascript
function TodoList() {
const todos = useStoreState((state) => state.todos);
const addTodo = useStoreActions((actions) => actions.addTodo);
return (
{todos.map((todo, idx) => (
{todo}
))}
);
}
`
Examples 📚
See the example folder for more examples of how to use
easy-peasy`.
|
Peter Weinberg |
Jørn A. Myrland |
Sean Matheson |