Skip to content

Commit

Permalink
chore: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mychidarko committed Nov 19, 2023
1 parent af1c26f commit eafc6d4
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion packages/store/README.md
@@ -1,3 +1,41 @@
# Hana Store

Hana Store is a simple, lightweight and easy to use state management library for Hana. It focuses on developer experience, stability and performance. Unlike the 100s of other state management libraries out there, Hana Store comes with a lot of features out of the box, including:
Hana Store is a simple, lightweight and easy to use state management library for Hana. It focuses on developer experience and ease of use. It requires no boilerplate, no configuration, and no extra dependencies to get started.

## Example

```js
import { createStore } from '@hanabira/store';

/**
* Add default options based on your needs.
* This is optional.
*/
createStore({
state: {
count: 0,
},
reducers: {
increment: (state, payload = null) => {
return {
count: state.count + 1,
};
},
},
});

/**
* Use the store in your components.
*/
const Counter = () => {
const [count, setCount] = useStore('count');
const increment = useReducer('increment');

return (
<div>
<p>Count: {count}</p>
<button onClick={() => increment()}>Increment</button>
</div>
);
};
```

0 comments on commit eafc6d4

Please sign in to comment.