The vanilla alternative for writing JSX-based React applications
git clone git://soophie.de/figure
blob: d1bca74efc07fd44b7ec72c854eb3972ab3a2df9 (557 bytes)[doc][blame][raw]
1
# segment2
Reactive template literals for React4
### Example6
```javascript7
import {segment, html, css} from './segment.js';9
segment({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
```