Skip to content

Commit 847ea18

Browse files
authoredAug 15, 2019
Merge pull request #34 from nbrady-techempower/fix-initialstate
Fix initialState bug
2 parents 455d06e + 4480d4f commit 847ea18

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed
 

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@techempower/react-governor",
3-
"version": "0.6.1",
3+
"version": "0.7.0",
44
"description": "The easiest way to govern over your application's state and actions.",
55
"license": "BSD-3",
66
"repository": {

‎src/index.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useMemo, useReducer } from "react";
1+
import { useReducer, useState } from "react";
22

33
class Governor {
44
constructor(contract, dispatch, initialState, middlewares = []) {
@@ -147,10 +147,8 @@ function useGovernor(initialState, contract, middlewares) {
147147
}
148148

149149
const [state, dispatch] = useReducer(reducer, initialState);
150-
151-
const governor = useMemo(
152-
() => new Governor(contract, dispatch, initialState, middlewares),
153-
[contract, initialState, middlewares]
150+
const [governor] = useState(
151+
new Governor(contract, dispatch, initialState, middlewares)
154152
);
155153

156154
governor.__state = state;

0 commit comments

Comments
 (0)
Please sign in to comment.