DEV Community

Discussion on: You don’t need React for building websites

 
stojakovic99 profile image
Nikola Stojaković

When debugging you're mostly debugging React/Vue/Angular problems, not Javascript. Requiring someone to learn new syntax for methods that do exactly what vanilla JS does already is kinda dumb.

This is true for using pretty much any library - does it mean people should stop using libraries at all and start writing everything from scratch? I don't think so.

Not understanding dependencies leads to things breaking and you can't fix them unless someone on stack overflow solved it or your dependency actually has a community and active devs writing fixes. Again, vanilla JS problems all have solutions documented a thousand times over across the web.

Same question as above. Yes, working with dependencies is hard sometimes, but how do you think you can write modern web applications without additional dependencies?

SEO is not easy to implement without additional dependencies. A website needs proper SEO structure, why the frameworks don't make this the default [eg, every page must have a title, a description, a canonical url, and every link that opens a new window should have rel="noopener" on it, and a robots.txt and a sitemap.xml should be autogenerated by the framework. That's minimum.

I don't know, I find Gatsby pretty straightforward. It generates everything I need, from the pages to sitemap.xml.

On top of all of this accessibility is mostly forgotten, not even a foot note unless you're a large company, the frameworks could solve most of this by building it into their platform. Google and Facebook have the dev power to do it, but haven't.

You can use linter for this. It will warn you whenever you're making something which is not accessible. You can't really expect from UI libraries to have millions of things out of the box. Do one thing and do it great - that's the philosophy which libraries should follow in most cases.

Thread Thread
 
stojakovic99 profile image
Nikola Stojaković

These are pretty much all trade-offs you have to make when you're writing anything a bit more complex than a simple static website.

Thread Thread
 
ravavyr profile image
Ravavyr

Gonna try to respond to each of these:

I agree, we shouldn't write EVERYTHING from scratch, but A LOT of npm packages are 5 lines of code that anyone CAN write and understand versus install and have no clue what it's doing.

WE CAN write modern web applications without a multitude of dependencies. indiegameshowcase.org is fully vanilla JS SPA [The frontend has tinymce, the rest is just javascript] with a NODE backend.

The backend has only the following dependencies:
"dependencies": {
"@pm2/io": "^5.0.0", [for logs]
"aws-sdk": "^2.962.0", [for file uploads]
"dotenv": "^10.0.0", [environment files]
"email-validator": "^2.0.4", [validate emails]
"express": "^4.17.1", [actual server stuff]
"express-blacklist": "^1.0.3",
"express-defend": "^1.0.9",
"express-rate-limit": "^5.3.0",
"express-session": "^1.17.2",
"mailersend": "^1.1.0", [send legit emails]
"multer": "^1.4.2", [upload files]
"mysql": "^2.18.1", [database]
"password-hash": "^1.2.2" [secure passwords]
}
I don't think it could be done with less without recreating a TON of code.

"Do one thing and do it great" is nice in theory, but in reality it causes far too much abstraction and you end up with 20 libraries written by 50 different developers and it's all code you don't understand. More often than not you can write the same functionality easily, but newbies don't know so they pile them on and you get a 15MB bundle. Google "React bundle size" and look how many articles are there just to tell people how to reduce it by removing crap they don't need, or worse, install more libraries to do it.

Linters make developers lazy because they stop understanding how to debug their code, and really most of the stuff linters do is pointless crap like "80 characters per line" or "new line at end of file" or "remove semi-colons"....like none of these things improve your code and basic syntax errors already show in VSCode and other editors.

Linters also do not teach you accessibility, they have automated rules you can follow, but this only does part of it. People think accessibility is just code rules, but there's an "experience" that you need to build for accessibility and that's 75% of it that most devs using tools for it, don't accomplish correctly.

Gatsby doesn't set up everything you need for SEO, and it's another package you install that you don't have a full understanding of, which isn't necessary. [Gatsby of course is useful for other reasons]

You don't have to agree. This is just my opinion from years of working with other people's code.