{"repo":"lostpebble/pullstate","free":true,"listed":false,"github":"https://github.com/lostpebble/pullstate","clone":"git clone https://github.com/lostpebble/pullstate.git","description":"Simple state stores using immer and React hooks - re-use parts of your state by pulling it anywhere you like!","language":"TypeScript","stars":1072,"topics":["react","hooks","reactjs","immer","state-management","state","server-side-rendering"],"license":"MIT","category":"ui-components","readme_excerpt":"pullstate Ridiculously simple state stores with performant retrieval anywhere in your React tree using the wonderful concept of React hooks! 7KB minified and gzipped! (excluding Immer and React) Built with Typescript, providing a great dev experience if you're using it too Uses immer for state updates - easily and safely mutate your state directly! NEW - Create async actions and use React hooks or to have complete control over their UI states! Originally inspired by the now seemingly abandoned library - bey. Although substantially different now- with Server-side rendering and Async Actions built in! Bey was in turn inspired by react-copy-write. Try out a quick example: 🎉 New documentation site is live! Installation Quick example Quick example - Server rendering Async Actions Creation Usage Async action hooks --- Let's dive right in This is taken directly from the documentation site, to give you a quick overview of Pullstate here on github. Be sure to check out the site to learn more. To start off, install pullstate . Create a store Define the first state store , by passing an initial state to new Store() : Read our store's state Then, in React, we can start using the state of that store using a simple hook useState() : The argument to useState() over here ( s = s.isDarkMode ), is a selection function that ensures we select only the state that we actually need for this component. This is a big performance booster, as we only listen for changes (and if changed, re-render the c","default_branch":null,"files":null,"tree":[],"storefront":"/r/lostpebble","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/lostpebble/pullstate/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}