Encourage using const declarations for non-changing variables#15839
### Describe the problem It's confusing why non-changing variables are declared using `let` in docs examples. Here is an example from [svelte $props page](https://svelte.dev/docs/svelte/$props): ```svelte <script lang="ts"> let { adjective } = $props(); </script> <p>this component is {adjective}</p> ``` Immediate question in head - `adjective` is never changed, why not use `const` ? [Updating props](https://svelte.dev/docs/svelte/$props#Updating-props) section describes that `adjective` will be updated if parent component passes another value. It will be changed no matter how it's defined, using `let` or `const`. Page also says that using `let` gives an ability to temporary change the value but it will be overridden if parent passes value update. Next page notes: > While you can temporarily reassign props, you should not mutate props unless they are [bindable](https://svelte.dev/docs/svelte/$bindable). > In summary: don’t mutate props. Either use callback props to communicate changes, or — if parent and child should share the same object — use the [$bindable](https://svelte.dev/docs/svelte/$bindable) rune. As far as I understand it's advised to use non-mutable props which can be ensured by using `const` declarations. Why not encourage using `const` in docs examples then? Am I missing something? ### Describe the proposed solution Update docs examples with `const` declarations where it makes sense ### Importance would make my life easier
This issue appears to be discussing a feature request or bug report related to the repository. Based on the content, it seems to be still under discussion. The issue was opened by vladshcherbin and has received 6 comments.