Skip to content

Latest commit

ย 

History

History
29 lines (23 loc) ยท 644 Bytes

01_Reactive.md

File metadata and controls

29 lines (23 loc) ยท 644 Bytes

Assignments are 'reactive'

Svelte์˜ ๋ฐ˜์‘์„ฑ์€ ํ• ๋‹น์„ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•จ. .push() ์™€ .splice()๋Š” ์ž๋™์œผ๋กœ ์—…๋ฐ์ดํŠธ๋ฅผ triggerํ•˜์ง€ ์•Š์Œ. -> ํ›„์† ํ• ๋‹น ํ•„์š”
let arr = [0, 1];

function handleClick() {
    arr.push(2);
    arr = arr;  // subsequent assignment
}
Svelte์˜ <script> ๋ธ”๋ก์€ component๊ฐ€ create ๋  ๋•Œ๋งŒ ์‹คํ–‰. prop๊ฐ€ ์—…๋ฐ์ดํŠธ๋  ๋•Œ ์ž๋™์œผ๋กœ ๋‹ค์‹œ ์‹คํ–‰๋˜์ง€ ์•Š์Œ

$

statement๋ฅผ ๋ฐ˜์‘ํ˜•์œผ๋กœ ๋งŒ๋“œ๋Š” JS label syntax
๊ฐ’์ด ๋ณ€๊ฒฝ๋  ๋•Œ compoment markup์ด render๋˜๊ธฐ ์ „์— ์‹คํ–‰
export let title;
$: document.title = title;