0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-30 00:46:29 +01:00
svelte/documentation/examples/03-logic/00-if-blocks/App.svelte

16 lines
257 B
Svelte
Raw Normal View History

2019-03-10 20:53:01 +01:00
<script>
let user = { loggedIn: false };
function toggle() {
user.loggedIn = !user.loggedIn;
}
</script>
{#if user.loggedIn}
2023-05-14 07:50:43 +02:00
<button on:click={toggle}> Log out </button>
2019-03-10 20:53:01 +01:00
{/if}
{#if !user.loggedIn}
2023-05-14 07:50:43 +02:00
<button on:click={toggle}> Log in </button>
{/if}