The vanilla alternative for writing JSX-based React applications
git clone git://soophie.de/figure
blob: 2884551d97bad1f9e708c776519a67fabcdb0f97 (547 bytes)[doc][blame][raw]
1
# figure2
Reactive template literals for React4
### Example6
```javascript7
import {figure, html, css} from '...';9
figure({ createElement });11
const Counter = () => {12
const [count, setCount] = useState(0);14
const style = css`15
.counter { ... }16
`;18
return html`19
<div class="counter">20
${style}21
<button @click="${() => setCount(count - 1)}">-</button>22
<p>${count}</p>23
<button @click="${() => setCount(count + 1)}">+</button>24
</div>25
`;26
}28
render(createElement(Counter), document.querySelector('#app'));29
```