1.0.2 • Published 10 months ago

rugs v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

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>
    </>
  );
}

EOF

1.0.2

10 months ago

1.0.1

11 months ago

1.0.0

12 months ago