https://github.com/arnelenero/simpler-state Skip to content Sign up Sign up * Why GitHub? Features - + Mobile - + Actions - + Codespaces - + Packages - + Security - + Code review - + Project management - + Integrations - + GitHub Sponsors - + Customer stories- * Team * Enterprise * Explore + Explore GitHub - Learn and contribute + Topics - + Collections - + Trending - + Learning Lab - + Open source guides - Connect with others + The ReadME Project - + Events - + Community forum - + GitHub Education - + GitHub Stars program - * Marketplace * Pricing Plans - + Compare plans - + Contact Sales - + Education - [ ] [search-key] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up Sign up {{ message }} arnelenero / simpler-state * Notifications * Star 151 * Fork 5 The simplest app state management for React simpler-state.js.org MIT License 151 stars 5 forks Star Notifications * Code * Issues 1 * Pull requests 0 * Actions * Projects 0 * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Security * Insights main Switch branches/tags [ ] Branches Tags Nothing to show {{ refName }} default View all branches Nothing to show {{ refName }} default View all tags 2 branches 0 tags Go to file Code Clone HTTPS GitHub CLI [https://github.com/a] Use Git or checkout with SVN using the web URL. [gh repo clone arnele] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching Xcode If nothing happens, download Xcode and try again. Go back Launching Visual Studio If nothing happens, download the GitHub extension for Visual Studio and try again. Go back Latest commit @arnelenero arnelenero Update docs ... d0663a8 Mar 22, 2021 Update docs d0663a8 Git stats * 126 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github/ISSUE_TEMPLATE Initial implementation Mar 7, 2021 docs Update docs Mar 22, 2021 src 1.0.0-rc.6 Mar 21, 2021 .babelrc.js Initial implementation Mar 7, 2021 .editorconfig Initial implementation Mar 7, 2021 .gitignore Initial implementation Mar 7, 2021 .npmignore Initial implementation Mar 7, 2021 .prettierrc Initial implementation Mar 7, 2021 .travis.yml Initial implementation Mar 7, 2021 CHANGELOG.md Initial implementation Mar 7, 2021 LICENSE Initial implementation Mar 7, 2021 README.md Update README Mar 22, 2021 _config.yml Set theme jekyll-theme-architect Mar 7, 2021 index.d.ts Add support for async initial value Mar 19, 2021 package-lock.json Add more tests Mar 7, 2021 package.json 1.0.0-rc.6 Mar 21, 2021 test-setup.js Initial implementation Mar 7, 2021 View code README.md SimpleR State npm build coverage license SimpleR State is an ultra-lightweight library that provides the simplest state management for React. * Minimalist API; no complicated concepts or boilerplate * Use plain functions to update state (including async) * Largely unopinionated with flexible syntax * Extremely simple to unit test state logic * Highly extensible with plug-ins (e.g. persistence, dev tools) * Full TypeScript support with uncomplicated types * Made specifically for React, and built on React Hooks * Multiple times faster than context/reducer solution * It's tiny, just around 1 KB (minified + gzipped) Get all these benefits with one dependency install: npm install simpler-state Two Easy Steps! Step 1: Create an entity (shared state) and actions (updater functions) // counter.js import { entity } from 'simpler-state' export const counter = entity(0) export const reset = () => { counter.set(0) } export const increment = by => { counter.set(value => value + by) // Alternatively: counter.set(counter.get() + by) } Step 2: Use the entity in your components with hooks import { counter, increment, reset } from 'counter' const CounterView = () => { const count = counter.use() return ( <>
{count}
) } It's that simple! But the library can do a lot more, so check out the docs website. Documentation Learn more about what you can do with SimpleR State at simpler-state.js.org. Feedback I have opened a Request For Comments (here) on GitHub. Your comments and suggestions would be greatly appreciated. And if you like this library, the concept, and its simplicity, please give it a star on the GitHub repo to let me know. Prior Art This library is an evolution of the already production-proven react-entities that I also wrote. It shares the same stable core, but with a very different API. About The simplest app state management for React simpler-state.js.org Topics react hooks state Resources Readme License MIT License Releases No releases published Packages 0 No packages published Used by 2 * @cedric-sd @cedric-sd / Lorem * @BilalAlpaslan @BilalAlpaslan / React-BLoC-pattern Languages * JavaScript 100.0% * (c) 2021 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.