Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

svelte mount

<script>
	import { onMount } from 'svelte';

	let photos = [];

	onMount(async () => {
		const res = await fetch(`https://jsonplaceholder.typicode.com/photos?_limit=20`);
		photos = await res.json();
	});
</script>
Source by svelte.dev #
 
PREVIOUS NEXT
Tagged: #svelte #mount
ADD COMMENT
Topic
Name
9+5 =