예제를 선택하면 라이브 미리보기와 소스 코드를 나란히 표시하는 전체 화면이 열립니다.
컴포넌트는 그저 함수입니다. Counter()를 부를 때마다 각자 자기만의 카운트를 가집니다.
Counter()
import 'nuclo' function Counter(label: string) { let count = 0 // one per call return button(() => `${label}: ${count}`, { onClick: () => { count++; update() }, }) } export const Counters = () => div(Counter('A'), Counter('B'))