NEWS: Welcome to my new homepage! <3

Update README.md - figure - Unnamed repository; edit this file 'description' to name the repository.

figure

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 71e73f8e82c1d0398eab5b6d2cdbb4cda045bb2a
parent 0cd4b7e389e852cb230031c3b53ad236448a71f0
Author: Andreas <contact@typable.dev>
Date:   Sat, 17 Sep 2022 01:38:02 +0200

Update README.md
Diffstat:
MREADME.md | 27+++++++++++++++++++++++++++
1 file changed, 27 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md @@ -1,2 +1,29 @@ # segment Reactive template literals for React + +### Example + +```javascript +import {segment, html, css} from './segment.js'; + +segment({createElement}); + +const Counter = () => { + const [count, setCount] = useState(0); + + const style = css` + .counter { ... } + `; + + return html` + <div class="counter"> + ${style} + <button @click="${() => setCount(count - 1)}">-</button> + <p>${count}</p> + <button @click="${() => setCount(count + 1)}">+</button> + </div> + `; +} + +render(createElement(Counter), document.querySelector('#app')); +```