Svelte vs JSX
Example 1
Here you can see that in Svelte you need to learn about something called Snippets. But in JSX, you will be just using a function.
Svelte
JSX
Example 2
In Svelte, you can't have a prop that accepts both the Component
and Snippet
types. The way that Components and Snippets work are different. Because of this, when dealing with props, you most use the <MyComponent />
syntax for the Component
type and the {@render MyComponent()}
syntax for type Snippet
type to render them. Well, you can just use a condition to check if the prop is type of Component
or Snippet
, right? Wrong, you can't! It's not possible to differentiate between a Component
and a Snippet
.
https://github.com/sveltejs/svelte/issues/9774
In JSX, you don't face with stupid issues and limitations like this.