Your framework can fuck off
Obese frameworks like React and Vue are all the rage. I’m here to tell you that they can fuck off, plain and simple. They were designed to solve “scale” issues unique to fucking huge apps like Facebook—not exactly the project your average developer works on. Just because Facebook uses React for their problems doesn’t mean it’s right for yours.
The original founder of a style started out with hypothesis. But now it has become the gospel truth, and those who go into that become the product of it. It doesn't matter how you are, who you are, how you are structured, how you are built or how you are made...it doesn't seem to matter. You just go in there and be that product. And that, to me, is not right.
— Bruce Lee
The reason people love frameworks is down to state-based UI. It removes the complexity of having to constantly interact with the DOM, leaving you free to focus on the logic of your app.
You declare a template which tells the framework how the page should look based on your data. The framework takes care of the DOM interactions, making the necessary changes for the page to reflect the template.
My friend Chris Ferdinandi has written a bunch of articles about this:
- Refactoring a vanilla JS app with state-based UI
- State-based UI vs manual DOM manipulation
- State-based UI with vanilla JS
If you’re working on a small project, you might not even need state-based UI. Traditional DOM manipulation is perfectly manageable in some cases. Don’t use state-based UI if it’s overkill.
If you do need it, there’s a better way: small, lightweight “anti-frameworks”. They’re growing in popularity, but here’s a short list:
They provide the same benefits as the big frameworks at a fraction of the size. If you like React, consider trying Preact. It uses the same modern API, but weighs in at a measly 3 KB.
The Lean Web
If this stuff interests you, my friend Chris Ferdinandi gave a talk you’ll love. It’s called The Lean Web, and he put it all in an ebook. You can read it online for free. It will teach you why modern “best practices” are actually hurting the web, and a new set of principles for building simpler, faster web apps.
If you have questions, feedback, or any other suggestions, please do email me. I'd love to hear from you!