Post

I would argue that React already has slots with a different syntax via component props. It's not a perfectly ideal syntax, but, arguably, it's better than the string-matching chaos of web components. After all, I can write <ProfileCardRaw name="BellCube" description={<p>A very cool person!</p>} />

The problem you mentioned about knowing how it'll be used is a problem of the docs, not a problem of the syntax. Slots don't tell you how they'll be used any better than component props do, since all you see is a name and some magic syntax. Even a simple JSDoc comment over the prop definition works.

0 reposts2 likes