Skip to content

Commit

Permalink
Merge pull request #34 from nbrady-techempower/fix-initialstate
Browse files Browse the repository at this point in the history
Fix initialState bug
  • Loading branch information
msmith-techempower authored Aug 15, 2019
2 parents 455d06e + 4480d4f commit 847ea18
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@techempower/react-governor",
"version": "0.6.1",
"version": "0.7.0",
"description": "The easiest way to govern over your application's state and actions.",
"license": "BSD-3",
"repository": {
Expand Down
8 changes: 3 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useMemo, useReducer } from "react";
import { useReducer, useState } from "react";

class Governor {
constructor(contract, dispatch, initialState, middlewares = []) {
Expand Down Expand Up @@ -147,10 +147,8 @@ function useGovernor(initialState, contract, middlewares) {
}

const [state, dispatch] = useReducer(reducer, initialState);

const governor = useMemo(
() => new Governor(contract, dispatch, initialState, middlewares),
[contract, initialState, middlewares]
const [governor] = useState(
new Governor(contract, dispatch, initialState, middlewares)
);

governor.__state = state;
Expand Down

0 comments on commit 847ea18

Please sign in to comment.