From eafc6d4e46fc2523cd80cc7e9a5631fbb3c96c5d Mon Sep 17 00:00:00 2001 From: mychidarko Date: Sun, 19 Nov 2023 16:14:11 +0000 Subject: [PATCH] chore: update readme --- packages/store/README.md | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/packages/store/README.md b/packages/store/README.md index 872ae90..8b988ce 100644 --- a/packages/store/README.md +++ b/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 ( +
+

Count: {count}

+ +
+ ); +}; +```