re: Svelte is the most beautiful web framework I've ever seen VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Sorry, I dropped the Smiley from my reply :( Typing are definitely a hack, and a 3rd party one at that. I've often hit the sync thing myself. I ag...

Yup, TSX is super helpful.

Let's say you have loginComponent.tsx that defines the following component:

export const LoginButton = (props: {userId: string}): JSX.Element => {
   // ... do something with props.userId and then load the page
};

You can then have a main component (typically called App.tsx) like this:

<section>
    Hello! Welcome! Click this button to Login
    <LoginButton userId={userId} />
</section>

And if you forgot to pass userId in App.tsx then the compiler would let you know that you made a mistake. If someone later refactors LoginButton to add another mandatory property, then the compiler will let you know that you forgot to circle back to App.tsx.

Nice. Better to use the language than the react specifc prop checks IMHO

code of conduct - report abuse