- Видео 237
- Просмотров 99 582
Go Make Things
США
Добавлен 20 янв 2016
👋 Hi, I’m Chris Ferdinandi. I teach people front-end web development, and I believe there’s a simpler, more resilient way to make things for the web.
Each week, I share tips, tricks, code snippets, and occasional rants about the state of our industry. If you hate the complexity of modern front‑end web development and want to learn how to build a simpler, more resilient web, this is the channel for you.
Each week, I share tips, tricks, code snippets, and occasional rants about the state of our industry. If you hate the complexity of modern front‑end web development and want to learn how to build a simpler, more resilient web, this is the channel for you.
Episode 147 - The role of Web Components in your site or app
In today’s episode, I talk about the role Web Components play in your site or app (and why the're not the right choice for a full design system).In today’s episode, I talk about the role Web Components play in your site or app (and why the’re not the right choice for a full design system).
Show Notes & Transcript → (gomakethings.com/podcast/the-role-of-web-components-in-your-site-or-app/)
🔥 Black Friday Sale! Today through Monday, you can join the Lean Web Club (leanwebclub.com) for just $9/month. Try it free for 30 days, then get 50% off for the next year.
Show Notes & Transcript → (gomakethings.com/podcast/the-role-of-web-components-in-your-site-or-app/)
🔥 Black Friday Sale! Today through Monday, you can join the Lean Web Club (leanwebclub.com) for just $9/month. Try it free for 30 days, then get 50% off for the next year.
Просмотров: 60
Видео
Web Component FOIC (Flash of Invisible Content)!?!
Просмотров 7715 часов назад
🔗 Links - Progressively Enhanced Web Component: gist.github.com/cferdinandi/7d56eb85342ca17bd766bd1660fd8bf9 - JS Rendered Web Component: gist.github.com/cferdinandi/6747a2fdb084c90093be5933aff3bd06 Learn how to do stuff like this at the Lean Web Club. Sign up for free at leanwebclub.com. Hate the complexity of modern front‑end web development? I teach people a simpler, faster way to build for ...
Light DOM *and* Shadow DOM in a Web Component!?!
Просмотров 55314 часов назад
🔗 Links - Source code: gist.github.com/cferdinandi/55c72dc28881b2e8a566d6ee8587af7f - handleEvent(): gomakethings.com/the-handleevent-method-is-the-absolute-best-way-to-handle-events-in-web-components/ - Styling the Shadow DOM: gomakethings.com/series/styling-the-shadow-dom/ Learn how to do stuff like this at the Lean Web Club. Sign up for free at leanwebclub.com. Hate the complexity of modern ...
How to add Custom Events to Web Components
Просмотров 635Месяц назад
Source code: gist.github.com/cferdinandi/58d272dd09ef4fe76609b7ae9be89c58 Part 1: ruclips.net/video/2S4-42vjZwY/видео.html Part 2: ruclips.net/video/6pttzPPtiFA/видео.html Part 3: ruclips.net/video/xopiDHsNXtQ/видео.html Work on fun projects like this at the Lean Web Club. Sign up for free at !leanwebclub.com. Hate the complexity of modern front‑end web development? I teach people a simpler, fa...
How to customize a Web Component!
Просмотров 5402 месяца назад
Source code: gist.github.com/cferdinandi/4ca71af700acf8a9947c1a0d1704c19b Part 1: ruclips.net/video/2S4-42vjZwY/видео.html Part 2: ruclips.net/video/6pttzPPtiFA/видео.html Work on fun projects like this at the Lean Web Club. Sign up for free at !leanwebclub.com. Hate the complexity of modern front‑end web development? I teach people a simpler, faster way to build for the web. Get free Daily Dev...
Can I add state-based UI to a Web Component?
Просмотров 1,3 тыс.3 месяца назад
Source code: gist.github.com/cferdinandi/3dc2826f88dd5195a113d79e399ffc91 Work on fun projects like this at the Lean Web Club. Sign up for free at leanwebclub.com. Hate the complexity of modern front‑end web development? I teach people a simpler, faster way to build for the web. Get free Daily Developer Tips at gomakethings.com. ⏳ Timestamps 00:00 - Intro 01:32 - Recap of Project 02:15 - What i...
Can I convert a React app into a vanilla Web Component!?!
Просмотров 1,8 тыс.4 месяца назад
Source code: gist.github.com/cferdinandi/aaa0ccf87ea2acd56472244a37622673 Work on fun projects like this at the Lean Web Club. Sign up for free at leanwebclub.com. Hate the complexity of modern front‑end web development? I teach people a simpler, faster way to build for the web. Get free Daily Developer Tips at gomakethings.com. ⏳ Timestamps 00:00 - Intro 00:45 - Lean Web Club 02:00 - Rendering...
Episode 146 - It lets me write less JS!
Просмотров 2574 месяца назад
In today’s episode, I talk about why writing less JS might be a bad goal (what!?!).In today’s episode, I talk about why writing less JS might be a bad goal (what!?!). Show Notes & Transcript → (gomakethings.com/podcast/it-lets-me-write-less-js/) 🔥 Black Friday Sale! Today through Monday, you can join the Lean Web Club (leanwebclub.com) for just $9/month. Try it free for 30 days, then get 50% of...
Can you customize Web Components without a framework!?
Просмотров 1,6 тыс.4 месяца назад
Source code: gist.github.com/cferdinandi/9429aadec4790f6e85e11e83dacc31d0 Work on fun projects like this at the Lean Web Club. Sign up for free at leanwebclub.com. Hate the complexity of modern front‑end web development? I teach people a simpler, faster way to build for the web. Get free Daily Developer Tips at gomakethings.com. ⏳ Timestamps 00:00 - Intro 01:30 - Lean Web Club 02:05 - Customizi...
Episode 145 - The Shadow DOM is an anti-pattern
Просмотров 2384 месяца назад
In today’s episode, I talk about why I think the Shadow DOM is a solution in search of a problem.In today’s episode, I talk about why I think the Shadow DOM is a solution in search of a problem. Show Notes & Transcript → (gomakethings.com/podcast/the-shadow-dom-is-an-anti-pattern/) 🔥 Black Friday Sale! Today through Monday, you can join the Lean Web Club (leanwebclub.com) for just $9/month. Try...
Can you build a web app with vanilla Web Components in 2024 - PART 2!
Просмотров 1,9 тыс.5 месяцев назад
Source code: gist.github.com/cferdinandi/308b4721cf8a8d762098e09398498866 Part 1: ruclips.net/video/2S4-42vjZwY/видео.html Work on fun projects like this at the Lean Web Club. Sign up for free at !leanwebclub.com. Hate the complexity of modern front‑end web development? I teach people a simpler, faster way to build for the web. Get free Daily Developer Tips at gomakethings.com. ⏳ Timestamps 00:...
Can you build a web app with vanilla Web Components in 2024?!?
Просмотров 8 тыс.5 месяцев назад
Source code: gist.github.com/cferdinandi/088d7f4ca088f7becd911e3e60efeec1 Work on fun projects like this at the Lean Web Club. Sign up for free at leanwebclub.com. Hate the complexity of modern front‑end web development? I teach people a simpler, faster way to build for the web. Get free Daily Developer Tips at gomakethings.com. ⏳ Timestamps 00:00 - Intro 01:04 - Lean Web Club 02:18 - Building ...
How to build a show-hide component with JavaScript
Просмотров 8235 месяцев назад
Source code: gist.github.com/cferdinandi/813b8d599c98e68a4dd4616f9cc545ed W3C ARIA Authoring Guidelines: www.w3.org/WAI/ARIA/apg/patterns/disclosure/ Get coaching, courses, and coding resources at leanwebclub.com. Hate the complexity of modern front‑end web development? I teach people a simpler, faster way to build for the web. Get free Daily Developer Tips at gomakethings.com.
How to build your first Web Component
Просмотров 2,9 тыс.5 месяцев назад
Source code: gist.github.com/cferdinandi/5af9447941b64c1b58897ada14bf42aa Hate the complexity of modern front‑end web development? I teach people a simpler, faster way to build for the web. Get free Daily Developer Tips at gomakethings.com.
HTML Web Components
Просмотров 2 тыс.6 месяцев назад
While Web Components have been around for years, they're seeing a bit of a renaissance thanks to an emerging approach for authoring them: ditch the shadow DOM and progressively enhance existing HTML. In this talk, we'll look at what Web Components, how the "HTML Web Component" approach works, why it's awesome, and some tips, tricks, and gotchas when working with them. Hate the complexity of mod...
Episode 144 - Front end devs do not understand web accessibility
Просмотров 2688 месяцев назад
Episode 144 - Front end devs do not understand web accessibility
Episode 143 - Vanilla JS doesn't scale
Просмотров 2308 месяцев назад
Episode 143 - Vanilla JS doesn't scale
Episode 142 - PHP Islands Architecture
Просмотров 1229 месяцев назад
Episode 142 - PHP Islands Architecture
Episode 140 - Getting stuff done as a developer with ADHD
Просмотров 4359 месяцев назад
Episode 140 - Getting stuff done as a developer with ADHD
Episode 139 - Detecting when a Web Component is loaded with CSS
Просмотров 1019 месяцев назад
Episode 139 - Detecting when a Web Component is loaded with CSS
15 super rad web developer tricks (few people know this!)
Просмотров 504Год назад
15 super rad web developer tricks (few people know this!)
Two-way data-binding and reactivity with 15 lines of JS
Просмотров 1,2 тыс.Год назад
Two-way data-binding and reactivity with 15 lines of JS
How to build your first Web Component in less than 5 minutes
Просмотров 419Год назад
How to build your first Web Component in less than 5 minutes
How to choose between let and const in JavaScript (just use let!)
Просмотров 151Год назад
How to choose between let and const in JavaScript (just use let!)
Arrow functions vs. traditional functions in JavaScript
Просмотров 266Год назад
Arrow functions vs. traditional functions in JavaScript
Very interesting approaches, I learned a lot as always from your videos, I really appreciate your extensive knowledge. One very interesting thing I found in my research is the Declarative Shadow DOM, it allows you to include html inside the Custom Element (as you mentioned at 6:40), but initializing a Shadow Root without the need for Javascript!, and thus get the benefit of style encapsulation and optimization benefits when using <link rel="stylesheet"/>. I want to thank you for answering my question in such a complete way, it really helps me understand different perspectives about the problem. I also want to tell you that I really like the approach of your channel showing that you can do really cool things with vanilla Javascript, which is very different than most content creators, because of the frameworks that I think sometimes overcomplicate things. Keep going!
One approach I take for placeholder content in loading states is to duplicate the final markup but set aria-hidden="true" and visibility: hidden. It will occupy the same layout as the final content without magic numbers and is more future proof as styles evolve. The tradeoff is more markup to manage.
How you deal with Layout Shift with Web Components?, I am developing a text input custom element, but when the page refresh, there is no space occupy by the element until milliseconds later when it renders and the height of the element is not predictable before it loads. I am using Astro as SSR framework BTW.
Oh that is an AWESOME topic for my next video. Thank you!!
Hi Chris! Another great and helpful video. Could you share those articles that explain how you can have global styles bleed into the component?
THANK YOU! I knew I forgot something, but couldn't remember what! Just updated the description to include a link to the series: gomakethings.com/series/styling-the-shadow-dom/
I'm using something similar to this for a set of alert banners that are being served by our cdn. Super useful.
🔥🔥🔥
Im researching about web components to make our design system stable and consume them via wrappers according to our own frameworks like react 19, angular, vue. This is literally the only channel where I'm spending all the time. So good!
That's an awesome use for WCs! Alsi, I love the shitzhu puppy in your profile photo!
@@gomakethings thank you! His name is Bobo 😄
@@StingSting844 🥰
The Hollow Shadow DOM - <slot>
😂😂😂
Good stuff and being able to utilize both "worlds" was something I was curious about. Still learning but getting there. Thanks for explaining this very useful.
Glad you found it useful!
Super relevant to my exact current project! Didn't know you could do this. I had several components that don't even need a shadow dom at all now that I'm thinking about it rationally.
Awesome, so glad to hear that!
Great Video! From my understanding, web components it's a browser api, it's not a component application abstraction despite the name. The problem with web development in front-end today is that: either you need a heavy and difficult framework or you have to write it from scratch like the example in the video. I wrote that exacly same app in jails-js. Which is a library that's pretty much closer to "vanilla" development. It's about 63 lines of code compared with the video which has 175. The problem with vanilla style is that you have to create everything on your own... but I really believe that there's a space for libraries that can automate that with just 8kb.
I don't really know how to respond when developers seem to dislike writing code, to be honest. That aside: Jails is, frankly, a completely different mental model for building UI. The app like the one I built in this video is probably better suited to state-based UI like Jails, but so much of what ships on the web is not.
@@gomakethings Fair enough
@@O_Eduardo Sorry, that was a convoluted way of saying, "state-based UI was probably a better choice for this one, but Web Components are still awesome for many use-cases."
Nice job 👏
Too few views.
Thank you!
Quite a bit of overlap with ruclips.net/video/OAfoK5MTS5Q/видео.html ? There was no 'settings' property for the web component in that one. Not to say that overlap is bad.
Accidental re-record of existing content LOL
For a moment I was puzzled by the 'is-filled' attribute thinking that it just showed whether a square was filled or not. But looking at the code I understood that the attribute actually represented the character being stored in the square.
The use of ${pick} was a bit confusing. It looked like you were using template literals but you are not. You are using ordinary strings and ${pick} is simply a literal piece of string to be replaced.
That's right. Because it's passed in as an attribute value, and attribute values are always plain strings. There's no safe way to convert them into a template literal, so we have to use a string.replace() instead. I used template literal conventions, though, for ease, and to avoid conflicts with some static site generators that use a handlebars-style convention: double curly brackets like this: {{ }}
Thanks a lot. Looking forward to a new series about web components. I still can't get why they get so much hate from the dev community.
Me either, though the tide is slowly turning. Glad you enjoyed it!
I think your original issue was not local storage, it was that you were looking at the attribute on the custom element, which always has the placeholder, rather than the actual element inserted. In other words everything was working fine! For the emoji issue, it looks like there was an attribute on the list item with just the name. So I think you could use that instead of having to remove the emoji?
Excellent series, a series with workers would be a good idea 👍
Service workers, or workers more generally?
Great way to round out the series! I know you've almost certainly mentioned this elsewhere, but some people may not realise how awesome it is that this could even be used inside another JS framework, or could be used to have multiple web components trigger events on each other. Or obviously just with a little extra vanilla JS when that's all you need! As many have said, this is really how web components should be taught, and then only much later actually introduce the Shadow DOM as an advanced concept with specific use cases that most of the time you don't need. I'm a little sad that your series is finished, but otherwise still look forward to your next video on whatever that might be about.
So glad you enjoyed it! Anything you'd like me to cover next?
This is pure gold, I've followed your web component series with great interest. Since then I've already re-worked some of the code I used into web components, and it works just perfect! I did a working calendar web component, kanban board, user session timer and even a snake game, all customizable. Again, pure gold, anything else on the web is about typical shadow-dom'd components, but your approach just sticks with me. I have still much to learn, so please keep up the good work!
So happy to hear that!
Dope!!!
Thanks!!
Excellent explorational video. The live debugging is also really cool, there are tricks to learn on all aspects of programming and debugging is a big part! Thank you for the content!
Glad to hear you enjoyed the live debugging session! Totally unintentional!
@gomakethings Chris, just wondering about your choice to use Array.from(_nodelist_) rather than [..._nodelist_]. Is it a performance thing, or perhaps readability...?
What's going on with people recently saying web components are not a good practice (most precisely that they suck)?
It started with one guy, the dude behind SolidJS (a framework) complaining that they were hard to implement, which caused the framework crowd to get all worked up about it. A good summary (and some responses) can be found here: gomakethings.com/the-role-of-web-components-in-your-site-or-app/
great stuff, I would say in the coming years depth is where its at and striking the balance...So this type of content is really helpful.
Love this, until recently I only followed you on Mastodon, but these videos are very good. I especially like your "train-of-thought" way of coding. Will this series get to web components with slots/children? Coming from a mostly-React component model, I struggle with making web components that can act as wrappers, parents, etc.
Thanks! I probably won't be getting into slots, because that requires the Shadow DOM, and I believe the shadow DOM is an anti-pattern: gomakethings.com/the-shadow-dom-is-an-antipattern/
Nice! You built one of those "I will select a random user from the comments below and send them a $10 gift card" thingees! Looking forward to part 3.
Part 3 is now live here: ruclips.net/video/xopiDHsNXtQ/видео.html
Loved it! Sat back in my lounger and enjoyed watching you code up this little example. I now have a better idea of what web components are, and I much prefer this style of front-end web programming to React. I also like that you use a font that's large enough to be both readable on a TV screen and a mobile phone. Excited to see where you take in part 2 of this video! #Vanilla4Life🍦🍦🍦
I feel you... you like native... you even not use arrow functions
Yea, I use them selectively. I find them harder to read in most cases: gomakethings.com/when-should-you-use-arrow-functions-in-vanilla-js/
Hey this is was really great. I appreciate the explanation of "why" we are doing things a certain way. Nothing drives me more crazy than a tutorial that doesn't teach you anything.
Really enjoying these Web Component videos Chris
Hi, I'm new to your channel and i would like to thankyou for covering about web component since i was really interested about it
Hi I like the way you think in terms of using vanilla web components. I used to be a Delphi developer until Delphi ver 7. I'm going to have to start watching your stuff. I need to learn to get under the hood and see how these things work. Please continue on with your components and making web web applications. You perform a good service. Clark
Thank you!
Hey chris, how would you handle routing when working with web components?
It depends. Typically, I favor old-fashioned full page reloads. Browsers give you so much for free out-of-the-box, and I like to take advantage of that. If there's a compelling reason to use JS instead, though, I typically rely on query string parameters.
I liked the accessibility bits you had going on
Thanks! It's far too often an afterthought.
How to pass callback functions as props to a web component? Specifically, I want to create a form web component that accepts three callback functions as input: 1. `beforeSubmit`: a function to execute before the form is submitted 2. `afterSubmit`: a function to execute after the form is submitted 3. `onSubmit`: a function to execute while the form is being submitted What are the best practices for passing these callback functions as props to the web component?
I'll make a video about this soon, but the high-level is that I would recommend using custom events instead of callbacks for this: gomakethings.com/custom-events-in-web-components/
Please keep making content on web components!🎉
Will do, thanks!
Where is the follow up to this video? You talked about decoupling the data storage. I would love to see your implementation.
Haven't made it yet. I'm a bit behind. Sorry!
This is great content. Straight the the point and easy to follow. Please do more on web components and maybe a video on using web components with htmx.
Thanks! I hate HTMX with a passion, though, so that probably won't happen.
Im surprised you havent mentioned htmx at all, it seems like it'd be right up your alley. HTMX + web components + Reef would be an insane combo
Believe it or not, I *HATE* HTMX with a passion: gomakethings.com/why-not-htmx/
@@gomakethings yea, I get those reasons. I think both creators have similar goals, it's just achieved in different ways. I will say I'd rather use HTMX than make a whole component just to replace some HTML. I also had some issues working with Reef today. It's weird, it works but not as straightforward as it seems, one time I had to switch to using a store to get it working, the issue I ran across today involved component only rendering for one of instances unless I set the innerHTML first. After spending a while trying to use uuid and swapping between store, signal, component and render, I just wrote it in vanilla js instead. It's tough to debug because it doesn't throw exceptions
@@terrencemoore8739 Please feel free to open an issue on GitHub. I'd be happy to look at what's going on.
Your library looks very cool! I will definitely be using it
It feels like the missing link to solve my desire for modern frontend without needing to use some bastardized version of JavaScript to do it. I was also looking at Proxy. It seems Reef functions more like Signals. Are you familiar with JavaScript's Proxy? If so, could you explain how they're different?
Just looked at the GitHub, I was trying to do signals the other day but you figured out where I got stuck: the handler methods for signals. Brilliant idea!
Thought I responded to this but I looked at the GitHub for it, it does use Proxy. I couldn't figure out how to get from a proxy to a signal because of the handler. Your implementation is great. I wasn't able to find the non-jsx preact code you were talking about but I feel like this plus web components and maybe some HTMX is all I need
Love It!
Hey, just a little thing but a few times (e.g. 12:15) your coding was covered up by your picture. Might want to scroll a bit in future to keep the code visible :)
Ah crap, sorry I missed that! I'll do better in the next one!
@@gomakethings No worries. I'm loving these videos!
a tabs system with web components would be very useful
EXCELLENT suggestion!
Love your content... I wish I had found it 12years ago... It would have saved me lot of time on my VaJS journey...
Very interesting. I like how simple you made this look. I was wondering if it would beneficial to make more components as one would tend to do in React. So, even though the Square is basically just a button, it does have state of ' ', 'X' or 'O'. Or on the other hand, from the way you explain Web components before where wrap vanilla HTML in the HTML file with a Web Component, could you take most of the HTML out of the component and place it into the vanilla HTML section.
The reason I don't do that is because, frankly, I think the "react way" of building most UI is bad. It adds a LOT of extra complexity under the guise of scalability and simplicity.
@@gomakethings Good point.
What's your typical threshold for when to use state-based UI? When traditional DOM manipulation is becoming too much? I have a project that might be at this threshold. The project involves an and a UI that modifies content inside the . When the user interacts with the UI, we dispatch a custom event to update the , update it, then dispatch a custom event to update the UI. This was fine for a while but some updates to the UI were getting quite complex. For now, I switched to simply re-rendering the UI and managing keyboard focus for accessibility. It doesn't seem to harm performance at this scale, but it's a potential future issue. With a state-based UI approach, I guess I would maintain a central data object that represents the shared state of both the and the UI? Reef may be a good fit for my needs in this case.
For me, that threshold is usually when I have multiple pieces of UI all modified by the same piece of data or state. Below that threshold, state-based UI often feels like more work.
@@gomakethings That's helpful criteria, and is what I'm experiencing with keeping an 's DOM and the representation of that DOM with a UI in sync.
Great stuff
Thank you!
Wow glad I inspired u haha. Or maybe not. Let's watch this.... If I understood well, line 118 will act like each time u change the object square it will trigger a rendering.
That's correct! In most state-based UI libraries, a signal detects changes to its value and automatically causes a render to happen.
This is a great showcase of how easy/simple web components are compared to React. I would love to see more direct comparisons like this project!
Happy to keep creating them. Really appreciate the kind words!