React vs Web Components?

Поделиться
HTML-код
  • Опубликовано: 13 июл 2024
  • In this episode I talk React / Preact, JSX, all that good stuff... and how it all works with Web Components! Spoiler: they can work together just great :D
    While you're here check out Rob Dodson's site Custom Elements Everywhere: custom-elements-everywhere.com/
    And also his video on the very same stuffs: • Custom Elements Everyw...
    Shadow DOM docs: developer.mozilla.org/en-US/d...
  • НаукаНаука

Комментарии • 102

  • @PeteCarapetyan
    @PeteCarapetyan 5 лет назад +11

    The combination of high level objectives and low level code for each platform is the most helpful part of this video, for me.

  • @_oskareriksson
    @_oskareriksson 5 лет назад +5

    Keep 'em coming randomly! Keep making interesting/fun videos, not filler stuff to meet deadlines.

  • @rafaelkrizek9608
    @rafaelkrizek9608 5 лет назад

    Discovered your channel right now and it feels like finding a gem between the simulated ones... THANKS!!! Have a great day :)

  • @GuilhermeScaldelai
    @GuilhermeScaldelai 5 лет назад +8

    Thanks Paul for the amazing content! Keep it up the good work!

    • @aerotwist
      @aerotwist  5 лет назад

      Thanks for watching and saying nice things :)

  • @Manjeetkundu
    @Manjeetkundu 5 лет назад +1

    Damn that intro!! I love the focusing on "Web developer" and on coding lines.

  • @michongoma7598
    @michongoma7598 5 лет назад

    Every week please, whatever number of times. Always love your videos.

  • @peksipatongeis
    @peksipatongeis 5 лет назад +1

    Awesome videos, keep them coming!

  • @HSDevStudio
    @HSDevStudio 5 лет назад

    Was in a conversation today in my organisation to use angular as a framework over polymer to tailor web-components. Your thoughts really helped me to get it through. However, am not a one framework fan but the vision of a web-component to be build with that ease is what is amazing to me. Thanks a lot Paul. Rob's site proved to be the trump card. Thanks a lot again Paul for an awesome articulation.

    • @aerotwist
      @aerotwist  5 лет назад +1

      Really glad it helped. Honestly there are so many variables and it differs team to team. The main thing to know is you have options.

  • @rendrap
    @rendrap 5 лет назад

    I'm here for the B-roll 😁, awesome content & generous amount of humor!

    • @aerotwist
      @aerotwist  5 лет назад

      I'm here for that too. Glad it's working out!

  • @EduardUrbach
    @EduardUrbach 5 лет назад

    Quality content, thanks Paul!

  • @dominikdeimel9486
    @dominikdeimel9486 5 лет назад

    The B-Roll Master himself 👍🏻 awesome Video!

  • @DavideCatani
    @DavideCatani 5 лет назад

    Very illuminating, thanks for sharing! :)

  • @maximerossignol582
    @maximerossignol582 5 лет назад

    Thanks a lot for the shadow dom explanation 👌

  • @direct0000
    @direct0000 5 лет назад

    Just subscribed, looks like you've got some great content. Thanks

  • @RaphaelRafatpanah
    @RaphaelRafatpanah 4 года назад

    Great summary!

  • @Phlickey
    @Phlickey 5 лет назад

    Slightly random upload schedule works for me. Your content is just good content Mr. Lewis.

    • @aerotwist
      @aerotwist  5 лет назад

      Random is the only way I know how

  • @TarekFaham
    @TarekFaham 3 года назад

    Fantastic... More videos please...

  • @DrRobrez
    @DrRobrez 5 лет назад

    Awesome video, thanks

  • @srsajjad7460
    @srsajjad7460 5 лет назад +4

    +1 for the intro

  • @bigcheesepuff1
    @bigcheesepuff1 5 лет назад

    I did an experiment with custom elements ages ago, and really liked the concept, but was not really sure how it fits into the real world. - good vid. - would be interesting to compare Preact with Stimulus. - I have an existing rails/coffeescript app which I want to "enhance"

  • @duni7374
    @duni7374 5 лет назад +1

    Probably one of the most intelligent and well-spoken teachers in the web-dev community.

    • @aerotwist
      @aerotwist  5 лет назад

      That's very kind of you

  • @ACaruso
    @ACaruso 4 года назад

    amazing video

  • @firstprincipleslearning
    @firstprincipleslearning 5 лет назад

    As a summary for advantages of using shadow dom , you contain your style for the element, so it closes over the element itself and does not alter the rest of your code. And for events similarly, it stops at the shadow dom boundary and you can emit the event in a more semantic way, other than click, for the rest of the app. For example as a `wobble` event, so you can uniquely communicate what the event is specifically designed for.

  • @johnn4314
    @johnn4314 4 года назад

    This seems like the golden path!!!!

  • @chayanjana20
    @chayanjana20 2 года назад

    Good presentation 🎸🎸🎸🎸

  • @BliboranBass
    @BliboranBass 5 лет назад

    AHA a fellow bassist + fellow programmer! Great video too!

  • @nisarhassan7093
    @nisarhassan7093 5 лет назад

    Once Again Top Notch.

  • @glashio
    @glashio 5 лет назад +22

    For all good reasons... that's why i love Vanilla.js

    • @highmastdon
      @highmastdon 5 лет назад +3

      glashio great to see someone preferring web components over react, right? ;)

    • @rogermacias4647
      @rogermacias4647 5 лет назад +2

      That is why we build web components using custom elements and shadow Dom. Take a look.
      www.therogerlab.com

  • @skillfulactor09
    @skillfulactor09 5 лет назад

    I just found out youtube I love it alot thanks so much im new to web components and i want to get into it thanks

  • @oathplanners7838
    @oathplanners7838 5 лет назад +1

    I came to claim my love emoji. I have subscribed with 3 different accounts.

  • @ashrafal
    @ashrafal 5 лет назад +1

    We build new things based our experience, information we gain and learn from older constructs.
    jquery adhoc usage led to backbone and ember, pain and boilerplate code in backbone led to Angular and React. Angular and React learned and improved upon their own short comings.
    current custom component spec itself is heavy influenced by react just like riot, preact.

  • @evapardeza1647
    @evapardeza1647 Год назад +1

    React is a set of libraries with lots of tools to help you made components for your React web. Web Components are much more difficult to code even if they are a standard. By some reason, if you master React, you will end up creating nice components, and you'll find creating Web Components quite difficult.

  • @nuttygold5952
    @nuttygold5952 5 лет назад

    i like this.

  • @DavidAlsh
    @DavidAlsh 5 лет назад

    I suspect that JSX/React would be better suited inside the web component, to help it manage internal re-rendering/diffing rather than outside to manage composing the application

  • @deps..
    @deps.. 5 лет назад +1

    Hi Paul,
    I think writing a web components in a separate file like the VueJS Single File Component is a good idea? What do you think ?

    • @aerotwist
      @aerotwist  5 лет назад +1

      I'm no Vue expert, so I would say give it a try (if you can do it easily and without risking your project) and see how you go! And let me know how it goes.

  • @jonathanbakebwa2292
    @jonathanbakebwa2292 5 лет назад

    Do web components affect the layout and positioning of other elements on the DOM while being rendered?

    • @aerotwist
      @aerotwist  5 лет назад

      Yes. Just think of them as powered up s by default. They are inline and affect the flow of other elements.

  • @krosenk729
    @krosenk729 4 года назад

    great video! the super faint background music from some distance away is killing my ears. but I love the content! thanks for explaining it!

  • @feldinho
    @feldinho 5 лет назад

    btw, how would you build a custom form field using web components?

    • @aerotwist
      @aerotwist  5 лет назад

      Take a look at the Polycasts episode where Monica talks about it: ruclips.net/video/AVXu1_vaY2U/видео.html
      It's a two-parter :)

  • @jeremiahthompson82
    @jeremiahthompson82 2 года назад

    Your channel is awesome. Professional. Why not continue? You could have had close to 1 million subscribers

  • @Oswee
    @Oswee 5 лет назад +1

    Definitely there in the wild should not be a phrase "X vs Web Components"! Web Components could be just a building blocks for framework/library X! Or they can be used without any X!

  • @mihhailkapustin7886
    @mihhailkapustin7886 5 лет назад

    What is the intro music?

  • @adamdude
    @adamdude 4 года назад

    Why use a custom element vs just using the standard ones like div? Like, if I had a login form and I wanted it to be a custom element made up of the elements that make the login form, why use a custom element vs wrapping it all in a div and giving it a class name?

  • @Oswee
    @Oswee 5 лет назад

    Not an expert but i found that custom elements are really great for layout blocks as you can define attributes like hbox or vbox for a and set relative flexbox properties in shadow dom. This way my public styles holds just like representional state and not a structural. I mean.. my styles has holding only like colors, fonts, etc. and reraly sizing and positioning. But i am still absolute noob in all this.

    • @aerotwist
      @aerotwist  5 лет назад

      That's an interesting pattern. Hadn't really thought of that much. Will ponder some more...

  • @theoligarchist1503
    @theoligarchist1503 3 года назад

    does createObject work with those ?

  • @misterhtmlcss
    @misterhtmlcss 3 года назад

    Paul great video. One ask though. Could you publish this code in a Gist, GH or on codesandbox.io in the future or if you have this code here too? It's not because it's so hard to replicate, but it would be amazing to be able to very quickly jump on what I've learned and start breaking what you wrote to get that more full body experience. Anyway that might be just me, but I love breaking and messing with code I know that works and is a new concept so that I can understand it a bit better. Again...Awesome job as usual.

  • @edcoronado
    @edcoronado 4 года назад

    Hey man! Really appreciate this video. I stumbled on direflow.io the other day. It seems to be able to transform React components into Web Components. I was wondering if you could cover this topic?

  • @tkdsoleil
    @tkdsoleil 5 лет назад +4

    CSS in Javascript is interesting :)

  • @firstprincipleslearning
    @firstprincipleslearning 5 лет назад +5

    I just stopped doing whatever, watching it now.

  • @Meleeman011
    @Meleeman011 2 года назад +1

    Web components have made react obsolete holy crap. I just stumbled upon them but it's a really nice built in way for js to do components

  • @bavariantrawler
    @bavariantrawler 5 лет назад +1

    What is that word you used near 3:43? "groze"? I've heard you say it a couple times here and on the FunFunFunction video and I don't know what it means. Anyway, great video!

    • @aerotwist
      @aerotwist  5 лет назад +1

      Gross. Contain the gross. The eww. The bleh. The ugh 👍😁

    • @bavariantrawler
      @bavariantrawler 5 лет назад

      @@aerotwist Oh lol. That makes more sense. I was using Google Translate to see if "groze" meant something in a different language. 😂

    • @aerotwist
      @aerotwist  5 лет назад +1

      Classic

  • @samirsaeedi74
    @samirsaeedi74 5 лет назад +1

    It's not necessary to store the shadow root in a property. It gets stored in this.shadowRoot automagically.

  • @Jeremybelleu
    @Jeremybelleu 5 лет назад +4

    I think that the "P" on the mug stands for "Preact". Change my mind.

    • @aerotwist
      @aerotwist  5 лет назад +4

      I will not refute any of this

    • @WestbrookJohnson
      @WestbrookJohnson 5 лет назад +1

      I just assumed he stole it from one of the other Pauls...

    • @aerotwist
      @aerotwist  5 лет назад +2

      Shhhhhhhhh! /Looks over shoulder

  • @CodingPhase
    @CodingPhase 5 лет назад

    Question what do you like more react, polymer, preact

    • @aerotwist
      @aerotwist  5 лет назад +1

      I honestly don't have much of a preference. I've always had a thing for treating the web like a toolbox. Pick the right one for the job. Typically I guess I go straight to platform (the 4th option?) but I've happily used Preact as a glue as well.

  • @MaxArt2501
    @MaxArt2501 5 лет назад

    That reminds me of a quite interesting Twitter thread among React advocates about Web Components.
    Someon of the caliber of Michael Jackson called Web Components "a complete waste of time" and stated that "React should be built in to the freaking browser".
    Being such an opinionated library, I think it's a pretty extreme stance. Even Dan Abramov (who's always a very reasonable guy) disagreed: twitter.com/dan_abramov/status/1050696101102329856
    I think there's space for both React and Web Components, as you expressed in this video. React isn't 100% compatible at the moment, but if you don't have to deal with some edge cases you should be fine.
    I think the biggest pain points of WC are:
    - you _need_ JavaScript to make them work; yes, React too, but also:
    - SSR, SEO and the sort (event Googlebot is stuck at Chrome 41): in short, a React page canbe statically generated, while a WC page _cannot_
    - accessibility (solved by extending semantic elements... but still bound to JavaScript)
    - styling is cumbersome (somewhat mitigated by Ito Hayato and Amzi Rakina's proposal of passing stylesheed during CE definition: github.com/rakina/custom-element-default-style - already implemented in Chrome?!)
    For the rest, I think they're great! Although just for _smaller_ components and not for app-wide structural patterns. That's what React's good for (or Angular, or Vue...).

  • @sensiblehuman1763
    @sensiblehuman1763 3 года назад

    Your intro reminded me of Peter McKinnon

  • @samundrashrestha
    @samundrashrestha 4 года назад

    What happened why no more videos?

  • @matarrjobe4577
    @matarrjobe4577 5 лет назад

    dispatchEvent( new CustomEvent( 'wobble', { detail: {} ))

  • @lunar-ix9vu
    @lunar-ix9vu 4 года назад

    This is cool, but why use React as the glue for vanilla web components and instead use, say, lit-element for lit- (or vanilla) web components?

    • @aerotwist
      @aerotwist  4 года назад

      Just mostly showing it's possible. You never know.

  • @MaxArt2501
    @MaxArt2501 5 лет назад +6

    We meet again, RUclips's 301 views.

    • @aerotwist
      @aerotwist  5 лет назад +3

      Moved permanently to awesome?

  • @Pharaoh-99
    @Pharaoh-99 4 года назад

    this intro reminds me of borderlands

  • @SAS-qq5ce
    @SAS-qq5ce 5 лет назад

    its been almost 2 to 3 weeks you haven't uploaded any videos

    • @aerotwist
      @aerotwist  5 лет назад +1

      Correct. I should be uploading this week :)

  • @davidmaxwaterman
    @davidmaxwaterman 2 года назад

    This could do with an update...

  • @lordswaggity1213
    @lordswaggity1213 5 лет назад

    Music is a little too loud.

  • @AmxCsifier
    @AmxCsifier 5 лет назад

    4:51 WOOHOO!

    • @aerotwist
      @aerotwist  5 лет назад

      Not enough events called 'woohoo' imo 😂

  • @CarlosAraya25
    @CarlosAraya25 5 лет назад

    custom-elements-everywhere.com/ shows you whether web components will work with your framework. It doesn't show you how to make them work together, that's on you as a developer (and I should learn how to edit comments instead of deleting them)

    • @aerotwist
      @aerotwist  5 лет назад

      True. Good jump off point though... And hopefully all these bumps will be smoothed out

  • @Yoyomanmanholla
    @Yoyomanmanholla 3 года назад

    check your levels man.. intro and outro music is much louder than the audio of the main content

  • @ald890
    @ald890 5 лет назад

    Polyfills, memory, no ssr - polymer and web comopnents are fine but not for fast websites

    • @aerotwist
      @aerotwist  5 лет назад

      Aww citation needed there, buddy. There's plenty you can do in this space and it's not so clear cut as you make it sound.

    • @ald890
      @ald890 5 лет назад

      @@aerotwist I am working with web componets for 2 years, polymer 1 and 2, and I know what its advantages and disadvantages are, I wonder if RUclips will stay with this technology, considering that polymer is already deprecateed and just wait for the lit element. The environment is unstable.
      Sorry for this critic, behind that's I love RUclips work

  • @manfredadams3252
    @manfredadams3252 4 года назад

    Free yourself from frameworks.

  • @jamesmassa1999
    @jamesmassa1999 4 года назад

    You definitely cover some interesting and important topics, however, too much theatrics, not enough information. Unsubscribed.