actus-redux-devtools
v0.2.0-alpha.5
Published
Use Redux DevTools Extension with actus
Downloads
3
Readme
actus-redux-devtools
Use Redux DevTools Extension with actus
Install
npm install actus-redux-devtools
Examples
Usage
import { actus } from "actus";
import reduxDevTools from "actus-redux-devtools";
actus([
reduxDevTools({ name: "Optional instance name" }),
{
state: {...},
actions: {...},
subscribers: [...]
}
]);
React Counter App
import { actus } from "actus";
import reduxDevTools from "actus-redux-devtools";
import React from "react";
import ReactDOM from "react-dom";
actus([
reduxDevTools(),
{
state: 0,
actions: {
inc: ({ state }) => state + 1,
dec: ({ state }) => state - 1,
},
subscribers: [
({ state, actions }) => {
ReactDOM.render(
<>
<h1>{state}</h1>
<button onClick={actions.inc}>+</button>
<button onClick={actions.dec}>-</button>
</>,
document.querySelector("#root")
);
},
],
},
]);