rugs
v1.0.2
Published
A small and exquisite store for react.
Downloads
4
Maintainers
Readme
rugs
A small and exquisite store for react.
Install
npm install rugs
Usage
import {createSlice} from "rugs";
const useCountSlice = createSlice({
state: {
count: 0,
},
reducers: {
add: (state, action) => {
console.log("action", action);
state.count += 1;
}
}
});
function Foo() {
const [state, dispatch] = useCountSlice();
return (
<>
<h1>{state.count}</h1>
<button onClick={() => dispatch({type: "add"})}>add</button>
</>
);
}