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>} />

Imo <ProfileCardRaw description={<p>A very cool person!</p>}/> (especially if there are more props/render props!) is a lot harder to read/parse than <ProfileCardRaw> <p slot="description">A very cool person!</p> </ProfileCardRaw> This is an opinion, other peoples opinions may differ.

(counter to an earlier point I made) I think the platform kinda messed up on the syntax of slots, and the above is way better than: <arbitrary-element slot="whatever"> additionally, many slots don't even need or want a host element (p in your example).

What goofy semantics? Using the slot attribute? I just don't think that's goofy.

0 reposts0 likes

🤷 I think it's great that different people care about different things. Would be overwhelming if everyone cared about everything. Like, I would crumble if I cared about the same things you did while also having my current work load

You have an element wrapping the content in your proposed JSX syntax, it's just not a DOM element, it's a JSX thing. Elements are containers for other nodes. Especially with `display: contents`, it's really not bad to use a container when you need to group nodes.

well, I don't like that aspect of JSX either. haha like, <> </> is sorta what I want for non-element-wrapped content but 🤷 I guess maybe what I'm trying to figure if this is what I'm getting at: "need to group" *can* be subjective, I guess