Post

Still no way to add state? React community discovered long ago that stateless components have very limited utility. The constant conversion from SFC to classes led many to just forgo the former altogether.

If you need state, just use a regular component. Snippets are not supposed to replace components, you can use them to hold SVGs or similar, which doesn't need it's own state.

Not having to wrap everything in useCallback/useMemo, callback hell, performance issues with large components, state not representing the correct value after using setState, ... are also burdens Svelte does not have. I think this is a tiny burden, just organise your files properly and it's all good

He want's to be able to define state that's just encapsulated into a snippet rather than the parent. But I don't see why you wouldn't just make a component at that point. SFC have their own benefits so comparing to a react function doesn't make a ton of sense imo.

The difference is, creating a Svelte component requires a new file. React has never had this restriction and Svelte remains one of the few frameworks that does. It’s a _huge_ benefit being able to refactor, and split components in the same file in React (or Solid, etc)

That isn't what snippets are for though, they are just reusable pieces of markup. This feature is more for libraries and tools like Storybook to use, there are less use cases for end users building applications.

I really like the new createSubscriber API! Although I'm curious, what really is the difference between using this new API and simply having a state field that is set whenever an onchange event of the media query is received?

That's really cool, and I'm sure there are use cases where this will be extremely convenient. But out of the box I find it hard to find an actual use case for it. The demo seems to be a bit of an antipattern (I could achieve the same with simple components). Do you maybe have a real world example?

I saw some people arguing that Svelte doesn't allow export of multiple components from one file. This feature at least goes into the direction.

Yes but that's what I mean. You can find people arguing for any feature you can think of... doesn't mean it's a good idea. Personally I've never had the need to export multiple components; creating Svelte components is so easy! That's why I wonder what a best practice use case would be.