Skip to content

Commit

Permalink
Merge edf7e63 into a4b330c
Browse files Browse the repository at this point in the history
  • Loading branch information
nmccready committed Aug 26, 2019
2 parents a4b330c + edf7e63 commit 5154f3a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ function useCustom<T, A, WorkR extends WorkR[] = undefined>(
hookWork?: HookWork<WorkR>
): [T, A] {
const newListener = React.useState()[1];
const oldState = this.state;
React.useEffect(() => {
this.listeners.push(newListener);
if (oldState !== this.state) newListener(this.state);
return () => {
const listenersLength = this.listeners.length;
const filtered = [];
Expand Down

0 comments on commit 5154f3a

Please sign in to comment.