Skip to content
Discussion options

You must be logged in to vote

If you use const, you cannot reassign the variable, that is about it.

So in scenarios where you destructure and have at least one property you want to change, you have to use let. E.g.

<script>
  let { value = $bindable(), ...rest } = $props();
</script>
<input bind:value {...rest} />

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Fd929c2CE5fA
Comment options

@brunnerh
Comment options

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