본문 바로가기

svelte/part1: basic svelte

[introduction] Your first components

바로 코드 부터

<script>
	let name = 'andornot';
</script>

<h1>Hello {name}!</h1>

name 변수를 출력하고 있습니다.

마크업 내에서 참조할 때는 중괄호 { } 를 사용합니다.

 

당연하게도(?) 중괄호 { } 안에서는 자바스크립트를 사용할 수 있습니다.

<h1>Hello {name.toUpperCase()}!</h1>

 

개발환경 구성없이 테스트 하려면

https://svelte.dev/repl

'svelte > part1: basic svelte' 카테고리의 다른 글

[reactivity] assignments  (0) 2023.10.27
[introduction] HTML tags  (0) 2023.10.27
[introduction] Nested components  (0) 2023.10.27
[introduction] Styling  (0) 2023.10.27
[introduction] Dynamic attributes  (0) 2023.10.27