npm

Need private packages and team management tools?Check out npm Orgs. »

easy-peasy

2.6.6 • Public • Published

Howdy 👋

We have a release candidate (RC) for v3. 🎉

v3 is aimed at being our long term support (LTS) release, with the intention to avoid breaking changes and minimise the features that we add to the library.

The website for the RC can be found here

For those currently using v2; you can find the notes on the breaking changes included within the v3 PR.


 

Easy peasy state for React

 

npm MIT License Travis Codecov

Step 1 - Create your store

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

Step 2 - Wrap your application

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

Step 3 - 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>
  )
}

Highlights

  • Zero configuration
  • No boilerplate
  • Intuitive API
  • React hooks to use store within components
  • Thunks for data fetching and side effects
  • Computed properties - i.e. derived data
  • Global, shared, or component level stores
  • Immutable data store under the hood
  • Includes robust Typescript definitions
  • React Native supported
  • Includes APIs to aid testing
  • Wraps Redux, all the radness, without the boilerplate
  • Redux Dev Tools support preconfigured
  • Supports customisation of the underlying Redux store

Introduction

Easy Peasy provides you with an intuitive API to quickly and easily manage the state for your React application. Batteries are included - no configuration is required to support derived state, API calls, performance optimisation, developer tools etc.

Documentation

The official website contains all the tutorials and documentation you will need to get started.

install

npm i easy-peasy

Downloadsweekly downloads

4,429

version

2.6.6

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability