conditional-statementssveltesvelte-3

v-show alternative for Svelte


The case is that I'm showing Loading component on fetch request. I use store to set $loading to true and inside conditions is the Loading component. The problem is that the Loading component seems to be taking some time to show. It feels/looks like the reason is re-rendering of Loading component. So, I was looking for v-show like thing in Svelte, which I cannot find in Docs. (Don't get angry if its there, just tell me.)

Can anyone help with this case?


Solution

  • Either wrap it in an {#if someCondition} block, or slap a hidden={!someCondition} attribute on an element.