svelte if block

Solutions on MaxInterview for svelte if block by the best coders in the world

showing results for - "svelte if block"
Gianluca
24 Mar 2016
1{#if loaded}
2    <h1>Hello World!</h1>
3  {:else}
4    <h1>Loading...</h1>
5{/if}
6
7
8example 2:
9{#if status == 200}
10    <h1>Hello World!</h1>
11  {:else if status == 401}
12    <h1>Not Authorized</h1>
13  {:else}
14    <h1>Don't know what happened in there</h1>
15{/if}
Ida
27 Jan 2017
1{#if x > 10}
2	<p>{x} is greater than 10</p>
3{:else if 5 > x}
4	<p>{x} is less than 5</p>
5{:else}
6	<p>{x} is between 5 and 10</p>
7{/if}
Luka
17 Feb 2016
1<script>
2	let user = { loggedIn: false };
3	let toggle = () => user.loggedIn = !user.loggedIn;
4</script>
5
6{#if user.loggedIn}
7	<button on:click={toggle}>Log out</button>
8{/if}
9
10{#if !user.loggedIn}
11	<button on:click={toggle}>Log in</button>
12{/if}