4 ms·
Why use React for a blog where 99% of the content is static?
by pier25 6y ago
Why use React for a blog where 99% of the content is static?
- nikivi 6y agoReact is amazing at composition. Compared to most other things I tried. Next.js lets you render into static assets with super fast in-page transitions (out of the box). And if you want to add more complex behavior, it's easy to transition it on per page basis. i.e. I want to lock some pages (courses) only to GitHub sponsors. This is a bit 'harder' to do than alternatives like Hugo, Eleventy etc. (in my opinion) Oh and for blog part, if you want to do some fancy things like mdx, React/Next is nice as there is a template you can use for it https://github.com/hashicorp/next-mdx-enhanced https://github.com/hashicorp/next-mdx-enhanced Otherwise, you'd have to create something of your own.
- pier25 6y agoI do see your point about composition. Using partials is nowhere near as nice as using real components. I'm working on a Node SSR project and after trying a couple of templating engines I ended up using Svelte components in SSR mode.
- ncphillips 6y agoMakes it easy to build a CMS into your static website and edit it from production. My personal site is Next.js + TinaCMS and all the content is stored in the GitHub repository https://tinacms.org/guides/nextjs/github/initial-setup/ https://tinacms.org/guides/nextjs/github/initial-setup/
- pier25 6y agoIs that the same approach as Netlify CMS? How does it handle authentication? Is there a backend somewhere?
- PretzelFisch 6y agoWhat I wonder is why static, I come from blogging with dos blog( untile godaddy broke it). And while I never understood the use of plugins like silverlight or adobe I don't really see the harm in using a native js framework to pull the artical contents from the server and update the DOM over pulling and retemplatizing the whole html page. Am I missing something or is static more of a mind set gained from dealing with sites that need to draw the first render faster and handle larger scale in a day then my little old blog will see in a life time?
- pier25 6y agoThe point of using a SSG and deploying to a static host is that hosting becomes extremely simple. No need for a database, HTTPS included, deploying is just copying files, CDN is already included, and it's either free or very cheap. If you're ok with editing code files (markdown, html, etc) this is extremely simple to setup. You can even get a template somewhere[1] and just start producing content. Obviously this is only feasible for devs or maybe designers with HTML/CSS skills. I'd like to add that SSGs can also render dynamic data from an API or directly from a DB at build time. [1] https://jekyllthemes.io/ https://jekyllthemes.io/
- cercatrova 6y agoThat site is still static. Static doesn't mean there's no dynamic content but rather that no new files are sent from the server, including new JS files. If you ship the entire JS framework on page load, then the page is still static.
- pier25 6y agoYou can have a static SPA with code splitting though.
- cercatrova 6y agoYeah I agree, what do you mean by "though"?
- pier25 6y agoWell, you said: > no new files are sent from the server But you can have 'static' with code splitting and send new files from the server on each route change.
- cercatrova 6y agoWell it's more like, if there's a file bundle, it can be served, but no new files will be generated by the server and sent. The code split files already exist on the server, they're not generated anew so yeah it's still static.
- janpot 6y agothere's people here running doom on a pregnancy test, and you're surprised people want to run a blog on React?
- searchableguy 6y agoAs much of running it on a pregnancy test as nikola's valuation. https://twitter.com/Foone/status/1302453246536028160 https://twitter.com/Foone/status/1302453246536028160