3 ms·
As a seasoned engineer (compiler background), but beginner in frontend, I'm curious aboutthe lack of expressive power that Svelte incurs. Could you (or someone
by norswap 4y ago
As a seasoned engineer (compiler background), but beginner in frontend, I'm curious aboutthe lack of expressive power that Svelte incurs.
Could you (or someone) characterize things that are hard to do in Svelte?
- SebastianKra 4y agoOnce a data is transformed into a view in Svelte, you can't do anything with it in JS. For example, a component can't iterate over the children in a slot [1]. This is limiting when designing generic Component-APIs. As an extreme example: In React, I could trivially define a tabbed interface by mixing strings, JSX, and components, without imposing any DOM-structure. The component that reads this definition could use it to build a tabbed-view on mobile, and a master-detail-view on desktop. ...or it could build a table of contents. When defining the tab names, I can mostly use strings, but fall back to JSX if necessary. Importantly, the API is completely independent from the implementation. const tabs = [ { name: "Tab 1", icon: <img ... />, content: MainTab }, { name: <>Tab with <b>bold<b/> text</>, icon: <MyIcon ... />, content: SecondTab }, ] return <MyLayout tabs={tabs} /> [1]: https://github.com/sveltejs/svelte/issues/5381 https://github.com/sveltejs/svelte/issues/5381