3 ms·
This is very weird to me. It seems like a totally static site. What does it need React to do, exactly?
by smt88 7y ago
This is very weird to me. It seems like a totally static site. What does it need React to do, exactly?
- tscangussu 7y agoYou missed the point. It's not about what React does, it is the "nobody uses jQuery anymore, everybody uses React" syndrome. React doesn't need to do anything as long as we use it.
- smt88 7y agoI think you're attacking a straw man here. The people who want you to get rid of jQuery are mostly arguing that vanilla JS does what jQuery does. As for abstracting the relationship between data and presentation, there is definitely a React bandwagon, but that's kind of the second stage after getting past jQuery.
- tscangussu 7y agoI got your point, but who uses vanilla JS these days when you can just use React, specially when it is not needed?
- DangBigot 7y agoWhy would you not use the most popular web templating tool? What, specifically, are you suggesting as an alternative?
- jammygit 7y agoI can’t imagine a more suitable use case for a static site than for documentation. Why on earth?
- smt88 7y agoDocs can be really dynamic, like the ones that have runnable sample code in various languages. It's just that these docs... aren't.
- beatgammit 7y agoEven for those, it's completely reasonable to have most of the page be static and only have the runnable parts be dynamic. You could use React for the dynamic bits and regular HTML for the rest. Unfortunately, React typically takes over the whole page, so it's a little less straight forward.
- anchpop 7y agoI find react to be a very pleasant way to make websites, even static ones. And for static sites you can use SSR or something like GatsbyJS to make everything load as if you had actually written the html (i.e. no dependence on javascript). That's the approach I use for my blog and according to google pagespeed the only problem with it is that the TTFB is too high (which is surprising because I host it as a totally static site on AWS)
- pier25 7y agoHow is it surprising that rendering a React website is slower than simple HTML?
- robertoandred 7y agoAn SSR React site IS simple HTML.
- pier25 7y agoDoesn't matter, React has to rehydrate which blocks the CPU. SSR solves waiting for the API but not the CPU problem.
- robertoandred 7y agoThat doesn't affect TTFB.
- pier25 7y agoAh you are right, my bad. I was thinking of TTFI.
- anchpop 7y agoThe server doesn't do any rendering before serving the page. All the "SSR" is done exactly once at build time. To the server it's no different from serving any other site.
- tscangussu 7y agoBecause static sites are not cool anymore unless you use Gatsby and its GraphQL interface to read your markdown files, because directly read markdown from your disk is not cool either.
- robertoandred 7y agoWhy keep reading markdown from disk and regenerating the page when you can just compile the site once and be done with it? Much easier to cache.
- pier25 7y agoI think you missed the sarcasm from parent poster.
- andrewaylett 7y agoEven a static site needs to be generated somehow, and React is quite a nice way to generate HTML. It can even do that on the server, and disabling JS in dev tools shows that's what they do :).
- smt88 7y ago> Even a static site needs to be generated somehow No, it doesn't. You can just write it. Anyway, the question here is not why they're using React to generate a site, but rather why they're using it to display the site. As others have mentioned, there are lots of tools to write DRY HTML/CSS, then compile, then deploy as a static site. No one would ever know which tool you used. The weird thing here is that they're using React in the browser (not as a one-time step) for a completely static site.
- robertoandred 7y agoWhy not? There's no real downside when combined with SSR.
- paulryanrogers 7y agoComplexity is costly and generally more brittle
- beatgammit 7y agoI love using Markdown for documentation. It's readable in source, it's easy to compile to HTML, and it's pretty easy to add some JavaScript later for dynamic parts.
- andrewaylett 7y agoEven "just writing it" is a generation step.
- shriek 7y agoIf it's anything like my experience then one thing to switch to React or any frameworks would be for better developing experience. For simple pages templates are totally fine and frameworks might be overkill but when the projects starts getting big stringing templates together can be quite painful let alone debugging them. Just my opinion though but I'd also like to hear the actual reason for the switch.
- mosdl 7y agoFirefox's web developer tools are all react/redux now as well, and are much laggier because of it :(