0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-24 08:17:29 +01:00
svelte/documentation/docs/98-reference/21-svelte-reactivity.md
2024-10-07 17:59:25 +02:00

619 B

title
svelte/reactivity

Svelte provides reactive versions of various built-ins like SvelteMap, SvelteSet and SvelteURL. These can be imported from svelte/reactivity and used just like their native counterparts.

<script>
	import { SvelteURL } from 'svelte/reactivity';

	const url = new SvelteURL('https://example.com/path');
</script>

<!-- changes to these... -->
<input bind:value={url.protocol} />
<input bind:value={url.hostname} />
<input bind:value={url.pathname} />

<hr />

<!-- will update `href` and vice versa -->
<input bind:value={url.href} />

MODULE: svelte/reactivity