so://phie

figure

The vanilla alternative for writing JSX-based React applications
git clone git://soophie.de/figure

blob: d1bca74efc07fd44b7ec72c854eb3972ab3a2df9 (557 bytes)[doc][blame][raw]

1# segment

2Reactive template literals for React

3

4### Example

5

6```javascript

7import {segment, html, css} from './segment.js';

8

9segment({createElement});

10

11const Counter = () => {

12 const [count, setCount] = useState(0);

13

14 const style = css`

15 .counter { ... }

16 `;

17

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}

27

28render(createElement(Counter), document.querySelector('#app'));

29```