simpler-state
Advanced tools
Comparing version 1.0.0-beta.0 to 1.0.0-beta.1
{ | ||
"name": "simpler-state", | ||
"version": "1.0.0-beta.0", | ||
"version": "1.0.0-beta.1", | ||
"description": "The simplest app state management for React", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
# SimpleR State | ||
SimpleR State is an ultra-lightweight library that provides the simplest state management for React. | ||
[![npm](https://img.shields.io/npm/v/simpler-state)](https://www.npmjs.com/package/simpler-state) | ||
[![build](https://img.shields.io/travis/arnelenero/simpler-state)](https://travis-ci.org/github/arnelenero/simpler-state) | ||
[![coverage](https://img.shields.io/coveralls/github/arnelenero/simpler-state)](https://coveralls.io/github/arnelenero/simpler-state) | ||
[![license](https://img.shields.io/github/license/arnelenero/simpler-state)](https://opensource.org/licenses/MIT) | ||
__SimpleR State__ is an ultra-lightweight library that provides the simplest state management for React. | ||
It is part of the upcoming __SimpleR__ collection of all things that make React development a breeze. This library is an evolution of [__React Entities__](https://github.com/arnelenero/react-entities). | ||
## Two Easy Steps! | ||
__Step 1:__ Create an entity (shared state) and actions | ||
```js | ||
const counter = entity(0) | ||
const increment = by => { | ||
counter.set(counter.get() + by) | ||
} | ||
const decrement = by => { | ||
counter.set(counter.get() - by) | ||
} | ||
``` | ||
__Step 2:__ Use the entity in your components | ||
```jsx | ||
const CounterView = () => { | ||
const count = useEntity(counter) | ||
return ( | ||
<> | ||
<div>{count}</div> | ||
<button onClick={() => increment(1)}> + </button> | ||
<button onClick={() => decrement(1)}> - </button> | ||
</> | ||
) | ||
} | ||
``` | ||
It's that simple! |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14905
45