Skip to content

Commit

Permalink
Run state updates
Browse files Browse the repository at this point in the history
  • Loading branch information
pomber committed Jul 23, 2019
1 parent 3607663 commit 7f558b6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions didact.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ function useState(initial) {
queue: [],
}

const actions = oldHook ? oldHook.queue : []
actions.forEach(action => {
hook.state = action(hook.state)
})

const setState = action => {
hook.queue.push(action)
wipRoot = {
Expand Down

0 comments on commit 7f558b6

Please sign in to comment.