3 ms·
You don’t need any of this stuff to build a great web app. You don’t need react, you don’t need fancy javascript syntax that requires you have a complicated bui
by iamleppert 10y ago
You don’t need any of this stuff to build a great web app. You don’t need react, you don’t need fancy javascript syntax that requires you have a complicated build infrastructure. Babel has over 40,000 files. Think about that for a moment. 40k files for some shorthand syntax. Your "build" times may only be a few seconds now (anything that is over one second imo is too long), but just wait. They will get to 30+ seconds in no time and then you'll have to go dive into the belly of that 40k file beast to find out how to unfuck yourself. I've been there.
You don’t even need a framework most of the time. Most of the frameworks I’ve used are poorly designed (I'm looking at you Ember. If there are any Ember devs reading this, I'll meet you in the parking lot...) and represent the design choices of a someone working on some project probably a lot different than yours. It feels good to give up control and let someone else make some choices for you, until you realize you’ve built an application based upon their poor design, and then you’re stuck.
All you need is semantic HTML, the DOM, and some plain old javascript. Organize your code, write simply, don’t overcomplicate and try to make things too general because your problems probably are very likely concrete anyway. Don’t buy into the hype. Just because big company X uses something, doesn’t mean you need to use it on your projects too. Have you seen Facebook? Their product hasn’t changed or innovated appreciably in years so you shouldn’t be taking any lessons from them in how to build ‘scalable’ applications, whatever that means.
Don’t dump a 500 KB framework on the page to save a few milliseconds in incremental rendering. Or think you need to worry about performance or complexity before you even have an app.
Is it odd to anyone that the entire battle cry of React is rooted in pre-optimization? The myth that the DOM is somehow evil, or all pages will one day have millions of elements to manage? This is gladly spoonfed to people who don't understand how the browser works, and never learned the basics. Take away their framework and they don't know how to build apps!
It violates my sense of pragmatism to save a few ms in rendering when you delay the initial page load by 500 ms or more? I also personally find the mixing of declarative and imperative programming styles and JSX to be absolutely horrid and the debug experience of many of the immutable libraries to be terrible. And, if you actually performance test the stuff you'll see they are full of either outright lies or fabrications to make the authors look good. Hint: if every time you call a getter on an object it causes the framework to go 30 stacks deep you're not going to have good performance. Just try it in your framework of choice today. You're swear we're working in java these days with the stack traces so deep and abstracted they have lost all touch with reality.
My favorite recently is to find all kinds of bizarre wrappers for javascript libraries that could have been used well enough on their own. The wrappers don't really do anything other than hard-code the original author's API and basically act as a middle man. I guess everything needs to be wrapped in a react component to be useful these days huh?