Once you’re about to begin a brand new web site, what do you assume first? Do you begin with a library or framework , like React or Vue, or a meta-framework on prime of that, like Subsequent or Nuxt? Do you pull up a speedy construct instrument like Vite, or configure your webpack?
There’s an excellent tweet by Phil Hawksworth that I bookmarked a couple of years again and nonetheless like to today:
A couple of folks have requested me what I did to make this so quick.
The reply is: nothing.
I simply did not add something to make it sluggish.
I stored it easy.
The pages are pre-rendered.
The CSS is inlined.
The work was achieved earlier than you bought there.
— Phil Hawksworth (@philhawksworth) September 8, 2018
Your web sites begin quick till you add an excessive amount of to make them sluggish. Do you want any framework in any respect? Might you do what you need natively within the browser? Would doing it with no framework in any respect make your website lighter, or truly heavier in the long term as you create or optimize what others have already achieved?
I personally love the thought of delivery much less code to finally ship extra worth to the browser. Understanding browser APIs and what comes “totally free” may truly result in much less reinventing the wheel, and doubtlessly extra accessibility as you employ the instruments supplied.
As a substitute of pulling in a library for each single job you need to do, attempt to look below the hood at what they’re doing. For instance, in a venture I used to be sustaining, I observed that we had a React element imported that was delivery a whole npm package deal for a small (lower than 10-line) element with some CSS sprinkled on prime (that we had been overriding with our personal design system). After we re-wrote that element from scratch, our bundle measurement was smaller, we had been in a position to customise it extra, and we didn’t need to work round another person’s choices.
Now, I’m not saying you shouldn’t use any libraries or frameworks or parts on the market. Open supply exists for a motive! What I’m saying is to be discerning about what you carry into your tasks. Let the ability of the browser give you the results you want, and use much less stuff!