-
Notifications
You must be signed in to change notification settings - Fork 542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core: add new fields to MitosisComponent type: slots #325
Comments
great idea. only thing is this should probably be on
it would become
this would be a great eslint rule to eventually add too (cc @sahilmob), essentially that
is not allowed, you can only put jsx expressions as binding values if the binding name starts with |
yeah it depends on what version of slots we go with but the one with
|
ah yes I see makes sense. I could see that working too, or also if we did like this we wouldn't need any JSX parser updates, would work OOTB <Layout>
<Slot name="foo">
<Bar />
</Slot>
</Layout> that may be simplest in the short term as a result. then you can just get the slots with a helper, like
children will already be parsed as expected. or I guess could also be something like
and would similarly work ootb I'm open minded here though, no strong opinion on my side, would be nice to do it as conventionally as possible (I forget how vue/svelte/etc handle slots lately) |
we also have the ability to use $ attribute for special things too, since they are valid JSX but not valid HTML, like
so there is no prop name collision, if we liked that direction |
@steve8708 Sure thing. would love to add an eslint rule in the future 🚀 🚀 🚀 |
yeah what I was trying to avoid was the slot/prop collision. So I'm not sure if we should make it look more like react or html to make it look more like html
to make it look more like react
If we add
and react
I was thinking of adding
which would make more sense to react devs |
I think it makes more sense to leave <Header $w24 $pt6 $bgRed={isFailed}> |
ah yes collision avoidance makes sense, agreed with everything here 👍 |
thinking about it more. the Mitosis way is to support both since we support both ways with so I'll add support for both
and
^ I'll add support for this react-way then support the html-way version after |
I think we need optional linters to enforce the react-way vs html-way. For example one codebase may want to enforce every loop uses |
a component needs to have all named slots available and I think it should be added here. and inside of children we need Slot nodes
The text was updated successfully, but these errors were encountered: