Skip to content
Discussion options

You must be logged in to vote

A bindable property is identified by having get & set accessors.

If the set is missing, the update will only be local to the component, otherwise the value can be propagated through the set accessor to some other piece of state.

You need a getter if you want the mounted component to receive updates by referencing reactive state.

Example:

<script>
	import Input from './Input.svelte';
	import { mount } from 'svelte';

	let noBindingValue = $state('Text 1')
	let bindingValue = $state('Text 2');

	function noBinding(target) {
		mount(Input, {
			target,
			props: { get value() { return noBindingValue } },
		});
	}

	function binding(target) {
		mount(Input, {
			target,
			props: {
				get value

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Fd929c2CE5fA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants