# I re-invent the wheel - a rant.

**URL:** <https://forum.kirupa.com/t/i-re-invent-the-wheel-a-rant/650356>\
**Category:** web dev\
**Created:** [January 7, 2022, 7:47am UTC](https://forum.kirupa.com/t/i-re-invent-the-wheel-a-rant/650356 "2022-01-07T07:47:03Z")\
**Posts on this page:** 9\
**Page:** 2

<div class="post-metadata">

**Author:** ![Wayne](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/wayne/32/16501_2.png) [@Wayne](https://forum.kirupa.com/u/Wayne)\
**Post date:** [January 19, 2022, 3:38pm UTC](https://forum.kirupa.com/t/i-re-invent-the-wheel-a-rant/650356/21 "2022-01-19T15:38:59Z")

</div>

@steve.mills I wounder how the rendring speeds are between react and web components. I enjoy web components and hope for a new popular standard.

---

<div class="post-metadata">

**Author:** ![steve.mills](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/steve.mills/32/14961_2.png) [@steve.mills](https://forum.kirupa.com/u/steve.mills)\
**Post date:** [January 19, 2022, 10:24pm UTC](https://forum.kirupa.com/t/i-re-invent-the-wheel-a-rant/650356/22 "2022-01-19T22:24:10Z")

</div>

If you use a `documentFragement` rather than innerHTML to append your component on `connectedCallback` the rendering speed of the web component will be as fast as vanilla JS can get.

FYI you don’t have to use `shadow DOM` at all with web components. It does have a big performance hit. Shadow DOM is designed for cross origin components where you don’t want styles to clash.

Also you don’t even have `"mount"` a component with `innerHTML` or `documentFragment`.  
If you don’t have dynamic content just use the `custom-element`as a wrapper for static HTML and a hook for your JS logic.

I tend to use `custom-elements` for the labeling benefit and `connectedCallback` for `event listeners`.

What I would really find useful is `HTML imports` with `Slots` IF `http push` worked reliably.  
e.g.

```auto
<head>
  <link id = "body" rel="import" href="/templates/body.html">
<link for = 'body' rel="import" href="/data/body.json">
</head>

```

We used to have `html imports` in 2013 (deprecated 2020) (a bit different from above).

You can do something similar server side or SW, by streaming partials to the browser.  
e.g. (part of a basic stream)

```auto
let files = ['head.html', 'css1.html', 'body.json', 'tail.html']

let unSettled = files.map(x => fetchIt(x));
    for await(let [i, val] of unSettled.entries()){
        let type = files[i].split('.').pop();
        let res = await val;
        if (type == 'json') {let json = await streamJSON(res.body)}
        else { let HTML = await streamHTML(res.body)}
}

```

---

<div class="post-metadata">

**Author:** ![finchalex](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/finchalex/32/16671_2.png) [@finchalex](https://forum.kirupa.com/u/finchalex)\
**Post date:** [January 27, 2022, 2:03am UTC](https://forum.kirupa.com/t/i-re-invent-the-wheel-a-rant/650356/23 "2022-01-27T02:03:19Z")

</div>

I’ve come to realize that with all the CSS and JS frameworks in existence, it seems that all try to reinvent the wheel to do the same exact thing; it boils down to which you like best.

I feel overwhelmed by all the various solutions out there, so I feel compelled to reinvent the wheel myself, further adding to the myriad of choices. I feel like I’m relearning things every 6 months because of how drastically some of these tools change how they operate.

By the time we all hop on board with the latest trends, they’re already obsolete and something shiny and new is on the horizon 🥲

* * *

---

<div class="post-metadata">

**Author:** ![steve.mills](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/steve.mills/32/14961_2.png) [@steve.mills](https://forum.kirupa.com/u/steve.mills)\
**Post date:** [January 27, 2022, 6:36am UTC](https://forum.kirupa.com/t/i-re-invent-the-wheel-a-rant/650356/24 "2022-01-27T06:36:18Z")

</div>

I don’t subscribe to frameworks.

If your after a structure to your CSS the best I have seen by far is Andy Bells CUBE CSS methodology.

[![](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/a/1/a100e0e11faf2ebbbdaa33830df5de1163519bd8.jpeg "CUBE CSS with its creator Andy Bell") ](https://www.youtube.com/watch?v=Y3EKje3JIT4)

It goes nicely very with his Every Layout CSS Components.

> **[Relearn CSS layout](https://every-layout.dev/)**

If you want to use web components with React you can (BTW you don’t need `Shadow DOM`)

[![](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/d/e/de30d39c4d3c9f2622792cae319367adc6859931.jpeg "Using Web Components with React just got better!") ](https://www.youtube.com/watch?v=x9yUwiNtzBs)

If you want to build framework agnostic code this video is pretty decent (as well as the channel)

[![](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/0/6/0659e118d353669bc45193861f47aedbb893e596.jpeg "Freedom from front end frameworks (React, Vue, etc...)") ](https://www.youtube.com/watch?v=Z0Ocd8RmiWk&t=812s)

If your vanilla all the way, this guy takes it to the extreme:

> **[Shai UI](https://www.youtube.com/channel/UCJagBFh6ClHpZ2_EI5a3WlQ)**
>
> Are you sick of bloated UI frameworks, complicated design patterns, complex build systems, unneeded tools, compiled programming languages, types, UI components, XML, OOP, and architecture astronauts that needlessly waste your time? Well, join the...

On a side note, I’m building a browser based SSG/ page builder which utilizes CSS in JS , Web Components/ Custom- elements, HTML partials.

---

<div class="post-metadata">

**Author:** ![Wayne](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/wayne/32/16501_2.png) [@Wayne](https://forum.kirupa.com/u/Wayne)\
**Post date:** [January 27, 2022, 3:17pm UTC](https://forum.kirupa.com/t/i-re-invent-the-wheel-a-rant/650356/25 "2022-01-27T15:17:52Z")

</div>

Vanlia web components did not have good testing libraries. Has that changed? Compared to react.

---

<div class="post-metadata">

**Author:** ![steve.mills](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/steve.mills/32/14961_2.png) [@steve.mills](https://forum.kirupa.com/u/steve.mills)\
**Post date:** [January 28, 2022, 3:00am UTC](https://forum.kirupa.com/t/i-re-invent-the-wheel-a-rant/650356/26 "2022-01-28T03:00:47Z")

</div>

I think there’s a few out there.

> **[Easy Unit-Tests for your web-components](https://medium.com/@eavichay/easy-unit-tests-for-your-web-components-e26bf88483a9)**
>
> The missing tool that the web components needs.

TBH I don’t really use web-components like react does. I use object destructuring and template literals. I also use animations a lot so my testing is a lot more about FPS.

---

<div class="post-metadata">

**Author:** ![Wayne](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/wayne/32/16501_2.png) [@Wayne](https://forum.kirupa.com/u/Wayne)\
**Post date:** [January 28, 2022, 11:54am UTC](https://forum.kirupa.com/t/i-re-invent-the-wheel-a-rant/650356/27 "2022-01-28T11:54:54Z")

</div>

> **[Lit](https://lit.dev/)**
>
> Simple. Fast. Web Components.

---

<div class="post-metadata">

**Author:** ![steve.mills](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/steve.mills/32/14961_2.png) [@steve.mills](https://forum.kirupa.com/u/steve.mills)\
**Post date:** [February 2, 2022, 9:36pm UTC](https://forum.kirupa.com/t/i-re-invent-the-wheel-a-rant/650356/28 "2022-02-02T21:36:17Z")

</div>

It’s funny… A lot of the plain (no library) web component/ custom-element tutorials/ demos out there are from Java/ Ruby developers.

I think they see web components as the new `<applets>`.

There’s also a library called Stencil JS that “compiles” web components into the various framework equivalents.

> **[Stencil - A Compiler for Web Components | Stencil](https://stenciljs.com/docs/introduction)**
>
> Stencil has a number of add-ons that you can use with the build process.

---

<div class="post-metadata">

**Author:** ![steve.mills](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/steve.mills/32/14961_2.png) [@steve.mills](https://forum.kirupa.com/u/steve.mills)\
**Post date:** [February 2, 2022, 11:42pm UTC](https://forum.kirupa.com/t/i-re-invent-the-wheel-a-rant/650356/29 "2022-02-02T23:42:42Z")

</div>

This video is gold.  
The guy really knows what he’s doing with web components.  
It’s not really a beginners video but for developers who use frameworks it could be useful.

There’s a lot of use of private fields, getters, setters and even some use of slot ect.

[![](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/9/f/9f6d085601e7631369c593124fd56961874396e4.jpeg "Intro to Web Components - Full Walkthrough") ](https://www.youtube.com/watch?v=PFpUCnyztJk)

He’s also got a small framework/ library for web components.  
I haven’t used it so IDK how good it is.

I think some people cant feel comfortable developing without abstracting everything as much as possible… 😄

[Previous page](https://forum.kirupa.com/t/i-re-invent-the-wheel-a-rant/650356.md?page=1)
