/
githubmirror
/
solid
Обзор
Документация
Войти
/
githubmirror
/
solid
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v1.9.9
packages/solid-element/sample.jsx
33 строки
760 B
Calliope
Drop expired webcomponents.dev link (#2492)
06 авг 2025, 22:20
Не верифицирован
06 авг 2025, 22:20
c65bccc
Код
Авторство
О чём код?
import { createSignal } from "solid-js"; import { customElement } from "solid-element"; const style = `div * { font-size: 200%; } span { width: 4rem; display: inline-block; text-align: center; } button { width: 4rem; height: 4rem; border: none; border-radius: 10px; background-color: seagreen; color: white; }`; customElement("my-counter", () => { const [count, setCount] = createSignal(0); return ( <div> <style>{style}</style> <button onClick={() => setCount(count() - 1)}>-</button> <span>{count}</span> <button onClick={() => setCount(count() + 1)}>+</button> </div> ); });