-
Notifications
You must be signed in to change notification settings - Fork 13
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
Why? #2
Comments
I feel for ya. It's quite obtuse if you're completely new to the idea. The way I like to look at it is that it enables a way for you to write things like a native button, for example. It has it's on template / DOM to give it a particular look and feel. It allows you to specify children and it takes that content and displays it somewhere in the button. As the consumer, though, you have zero concerns about how it does that. All you know is that you've given it some children. This idea can be applied to complex examples like page layouts.
I've been closely following the web component specs since their inception in 2011 and the core concept hasn't changed. There's been a lot of drama, coming from many different sources, that has been designed to both bolster and hinder their progress. It's, unfortunately, created a lot of misinformation. The core concept is actually broken down into separate specs:
They're all designed to do something different and complement each other. The main concept is that they act as lower-level primitives for building on top of. They're not meant to disrupt anything, or have a huge, dramatic entrance into the web development scene. Fad APIs usually don't last very long. Both Sorry if I'm explaining something you already know.
What this means is that React can now have both DOM and CSS encapsulation using the native APIs. CSS-in-JS doesn't need to worry about encapsulation and head-mounting performance anymore. All any library would need to do is output a minified string in a style tag and put it in the shadow root. You can still have the nice ergonomics of using object literals, but a lot of the internal overhead is gone.
I originally did it to test some assumptions and to experiment with the possibilities on an unrelated issue. After doing so, it's reinforced why I think this particular declarative API for shadow roots is superior to what's being proposed (My proposal is here), because it lends itself to idiomatic usage, and bots don't need to have Shadow DOM support when rendered on the server.
I have no idea. If I use React on any personal projects, I'll be using this exclusively, though. Thanks for the questions :). Hopefully I've been able to answer them. I'll close this now, but feel free to continue the conversation if it helps you. |
@treshugart Your repo popped up on StackShare.io and I am intrigued. I looked at the Shadow-Tree spec and I can't say I understood a bit of it. But I feel like from what I do understand, Web Components is en route to really disrupt things, am I right? Since you've done this work I'm curious what does this mean for React and even CSS-in-JS? Why did you build this project? Is this the future of component based web development? If you have time to answer any of this thanks so much.
The text was updated successfully, but these errors were encountered: