|
|
|
|
|
by gregjor
2220 days ago
|
|
You have to weigh costs when talking about benefits. In the case of a small site with static content, you could write it with no JS code at all. The React code arguably makes it DRY and modular and all that, but unnecessarily. Now it's an order of magnitude more complex, with dependencies and a rendering step that don't need to exist at all. DRY, modular, etc. are not blanket principles that one must honor at all cost, in every circumstance. They are ways to simplify and organize complex code bases. Not making the code base complex in the first place takes first place, though. Brian Kernighan wrote "Controlling complexity is the essence of computer programming." The best way to control complexity is to eliminate it, and not introduce it in the first place. |
|
And it allows me to dynamically "fetch" my writings as I add more. I don't have to create a whole new html file. I simply write a markdown file, add it into the repo on github (I use slackedit which syncs directly to the github repo), then the website gets rebuilt with HTML, and then deployed.
Making the code base more maintainable and better suited for my purposes.
On the other hand, I do agree with you. React is a bit heavy weight for a static website. Next.js still ships the whole react bundle in production. So, while time to first paint is the same speed as a simple html, js site, the time to interaction is much slower and the network load higher.
Trade-offs for sure.