diff --git a/didact.js b/didact.js index 62436f1..377b2eb 100644 --- a/didact.js +++ b/didact.js @@ -219,7 +219,7 @@ function useState(initial) { }) const setState = action => { - hook.queue.push(action) + hook.queue.push(typeof action === "function" ? action : (prev) => action) wipRoot = { dom: currentRoot.dom, props: currentRoot.props, @@ -316,4 +316,4 @@ function Counter() { } const element = const container = document.getElementById("root") -Didact.render(element, container) +Didact.render(element, container) \ No newline at end of file