Is it really necessary to make and use new custom elements and web components (HTML tags)?

后端 未结 3 864
温柔的废话
温柔的废话 2021-01-28 21:52

I\'m currently learning Front-end web development and the difference between Vanilla JavaScript, frameworks and libraries (React for example). Now I\'m familiar with web compone

3条回答
  •  情歌与酒
    2021-01-28 22:10

    As you said, instagram uses react which doesn't transpile to web components

    react is not the only components based lib to NOT use web components, there's also ¹ : vue.js, Polymer.

    But some other components based lib do use web components as their base ¹ : slim.js, stencil.

    All of these libs can be used with webcomponents, some even tell us how to do: react, vuejs.


    !!! this part may be considered as opinion based !!!

    AFAIK the lib which chose not to use webcomponents were created before the web components API was finalized, and the cost to rewrite using them is too big.


    !!! this part is opinion based !!!

    Most person uses lib because web components doesn't give the same effortless two way binding.

    In opposition webcomponents seem to give more control about when the component reload and how the binding is done, but it needs to be coded which is extra work.


    ¹ based on the list of custom elements returned by this script on the main page of each lib

提交回复
热议问题