so://phie

figure

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

blob: 2884551d97bad1f9e708c776519a67fabcdb0f97 (547 bytes)[doc][blame][raw]

1# figure

2Reactive template literals for React

3

4### Example

5

6```javascript

7import {figure, html, css} from '...';

8

9figure({ 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```