5.0.4 • Published 2 years ago

easy-peasy-rf3 v5.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

npm MIT License Travis Codecov

All of this comes via a single dependency install.

npm install easy-peasy

Fly like an eagle

Create your store

const store = createStore({
  todos: {
    items: ['Create store', 'Wrap application', 'Use store'],
    add: action((state, payload) => {
      state.items.push(payload);
    }),
  },
});

Wrap your application

function App() {
  return (
    <StoreProvider store={store}>
      <TodoList />
    </StoreProvider>
  );
}

Use the store

function TodoList() {
  const todos = useStoreState((state) => state.todos.items);
  const add = useStoreActions((actions) => actions.todos.add);
  return (
    <div>
      {todos.map((todo, idx) => (
        <div key={idx}>{todo}</div>
      ))}
      <AddTodo onAdd={add} />
    </div>
  );
}

Our Sponsors ❤️

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].

Documentation

See the official website for tutorials, docs, recipes, and more.

OS Awards Nominee

Easy Peasy was nominated under the "Productivity Booster" category.