Skip to content

Commit

Permalink
Replace example
Browse files Browse the repository at this point in the history
  • Loading branch information
pomber committed Jul 23, 2019
1 parent 69f2efa commit 8ca3741
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions didact.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,18 @@ function reconcileChildren(wipFiber, elements) {
const Didact = {
createElement,
render,
useState,
}

/** @jsx Didact.createElement */
function App({ props }) {
return <h1>Hi {props.name}</h1>
function Counter() {
const [state, setState] = Didact.useState(1)
return (
<h1 onClick={() => setState(c => c + 1)}>
Count: {state}
</h1>
)
}
const element = <App name="foo" />
const element = <Counter />
const container = document.getElementById("root")
Didact.render(element, container)

0 comments on commit 8ca3741

Please sign in to comment.