-
|
I would guess that I should use I'd say I should use In certain scenario I encountered this warning with using just VariantsWith $state()<script>
let el = $state();
</script>
<div bind:this={el}></div>Without $state()<script>
let el;
</script>
<div bind:this={el}></div> |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Is there a question in your mind? I'll try to guess: Which should you use? IMHO, so long you use If you just don't want to think about this so finely, just go with reactive state. |
Beta Was this translation helpful? Give feedback.
Is there a question in your mind? I'll try to guess: Which should you use?
IMHO, so long you use
elinside an effect oronMount(), and your logic doesn't destroy the bound element reactively (like inside an{#each}or{#if}block), you should be ok with a non-reactive variable.If you just don't want to think about this so finely, just go with reactive state.