actus-react
v0.1.0-alpha.0
Published
React bindings for actus
Downloads
1
Readme
actus-react
React bindings for actus
Included and preconfigured plugins
Install
npm install actus-react
Examples
Usage
First create a store
// store.js
import { createStore } from "actus-react";
export const { actions, useSelector } = createStore({
state: {
number: 0,
},
});
Then use actions
and useSelector()
in your components, that's it!
// App.js
import { actions, useSelector } from "./store.js";
export default function App() {
const number = useSelector((state) => state.number);
return (
<>
<h1>{number}</h1>
<button onClick={actions.number.increment}>+</button>
<button onClick={actions.number.decrement}>-</button>
</>
);
}