From 0e4b7b8d8c3d3538e62f795be995f3cfd92cf2a8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 3 Feb 2025 14:54:28 -0500 Subject: [PATCH] Sync `svelte` docs (#1146) sync svelte docs Co-authored-by: svelte-docs-bot[bot] <196124396+svelte-docs-bot[bot]@users.noreply.github.com> --- .../svelte/07-misc/07-v5-migration-guide.md | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/apps/svelte.dev/content/docs/svelte/07-misc/07-v5-migration-guide.md b/apps/svelte.dev/content/docs/svelte/07-misc/07-v5-migration-guide.md index 32cdbac47..4e9e5fd01 100644 --- a/apps/svelte.dev/content/docs/svelte/07-misc/07-v5-migration-guide.md +++ b/apps/svelte.dev/content/docs/svelte/07-misc/07-v5-migration-guide.md @@ -723,7 +723,39 @@ If a bindable property has a default value (e.g. `let { foo = $bindable('bar') } ### `accessors` option is ignored -Setting the `accessors` option to `true` makes properties of a component directly accessible on the component instance. In runes mode, properties are never accessible on the component instance. You can use component exports instead if you need to expose them. +Setting the `accessors` option to `true` makes properties of a component directly accessible on the component instance. + +```svelte + + + +``` + +In runes mode, properties are never accessible on the component instance. You can use component exports instead if you need to expose them. + +```svelte + +``` + +Alternatively, if the place where they are instantiated is under your control, you can also make use of runes inside `.js/.ts` files by adjusting their ending to include `.svelte`, i.e. `.svelte.js` or `.svelte.ts`, and then use `$state`: + +```js ++++import { mount } from 'svelte';+++ +import App from './App.svelte' + +---const app = new App({ target: document.getElementById("app"), props: { foo: 'bar' } }); +app.foo = 'baz'--- ++++const props = $state({ foo: 'bar' }); +const app = mount(App, { target: document.getElementById("app"), props }); +props.foo = 'baz';+++ +``` ### `immutable` option is ignored