<svelte:component>
is deprecated in runes mode — components are dynamic by defaultsvelte(svelte_component_deprecated)
#12643
-
Hi there, What do I use instead of the following in svelte 5, Thank you!!!
|
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 6 replies
-
@ananduremanan check it out https://svelte-5-preview.vercel.app/docs/deprecations you can do:
|
Beta Was this translation helpful? Give feedback.
-
The docs could do a better job here, because for way too long my GPT brain tried this: |
Beta Was this translation helpful? Give feedback.
-
What about the case when looping through components with this doesn't work
this does work
this also works
ankitpatial's suggestion also works
EDIT: does work as expected when capitalized, interesting playground link for anyone curious |
Beta Was this translation helpful? Give feedback.
-
if its a Svelte component, my preference is that it starts with a Captial case. |
Beta Was this translation helpful? Give feedback.
-
@mwcm thank you for your research, it's getting me closer to the solution of my issue which is similar to your case but not quite. I am in this situation
And I would really love to do:
But it looks like it really dislikes having square brackets in there.
But I would prefer to avoid the loop. |
Beta Was this translation helpful? Give feedback.
-
What if I have the classic case of needing to switch out a html tag based on a condition? <svelte:component this={href ? "a" : "button"} class="{theme[color]} {sizes[size]} {classes} text-center justify-center flex gap-2 items-center rounded-lg font-medium click-in" onclick={onclick} {...rest}>{@render children()}</svelte:component>
|
Beta Was this translation helpful? Give feedback.
<column.template {rowData}
should also work