Static website frameworks for SAFE Network

That’s right!

Currently doing a maintenance release and accepting proposals to work on post-summer!


The following is a site built with React-static :slight_smile:

I struggle to see the difference between sites buit in React and those created with React Static to be honest. I don’t think they explain this very well. Or perhaps they assume a level of understanding that I don’t have.

1 Like

The difference is speed.

React-static generates the pages in advance, and will prefetch pages and resources that might be loaded next so you don’t have to wait for them to load when you click, or scroll etc.

I’m sure there are other techniques but I think that is the gist of it.

So if you click on a link in DWeb Blog, web or safe versions, the page loads instantly. A React site would only request the page after you click, which causes a delay which can end up being not just noticeable but a poor UX.

As I understood it React does that anyway, since a website is essentially one app so everything is ready to go. Certainly the Primer 2 site is pretty whizzy, but maybe there’s a noticable difference when you’re talking about larger sites or sites with lots of links. It would be interesting to see a side by side comparison.

I was going to learn React Static but found the concepts a bit alien, so thought it would be best to learn some React first. Maybe I’ll give it another try when I have some time (haha).

You could be right and I may not have understood. I haven’t learned either, so may be wrong but my impression is that there’s not that much difference in learning one or the other. I think that the same concepts, components etc apply to both (so I went to the React docs to understand how I might customise React-static), but React-static generates faster code by automating things that would take more work to achieve in React, and I would guess comes with some restrictions. But that is mostly guesswork.

Best to ask the React community, and Tanner in particular for a definitive answer.

I’ve asked @SleeplessByte if he might comment, and found this:

React vs React-Static: What are the differences?

What is React? A JavaScript library for building user interfaces . Lots of people use React as the V in MVC. Since React makes no assumptions about the rest of your technology stack, it’s easy to try it out on a small feature in an existing project.

What is React-Static? A progressive static-site framework for React . React-Static is a next-gen static site generator for React. Finally, you can build a website like you do any other React App. There’s no special CMS, query language, or crazy lifecycle hooks. Just good old React producing an amazing SEO-ready, user experience driven, progressively enhanced website. The effort is minimal, but the benefits are not!.

React belongs to “Javascript UI Libraries” category of the tech stack, while React-Static can be primarily classified under “Static Site Generators” .

And this intro from Tanner was one of the first things I read and very helpful. It includes:

Introducing React Static !

A progressive static-site framework for React, designed to deliver an amazing experience for your users and developers alike, without compromising React in any way. It’s insanely fast, SEO-ready, and is the most React-friendly static-site library on the planet.

Let’s get to it.

How is it different?

Contrary to most other static site generator for react, React-Static is very direct with how data flows from its source to a route. Not only does this provide a convenient abstraction point for managing all of your static data, but by keeping the data pipelining and react templating as separate as possible, your site can be built as a “function of state” with only a single pass of SSR!


This is not a bad idea!

On top of the resource given by @happybeing, (by Tanner), there are a few other considerations:

  • use React
  • when you now deploy, each client needs to download react and the data and build it locally
  • SSR solves this. It lets the server render the site and send back both: the data and the html. More bandwith required, but no need to wait for the local build of a page
  • react-static does not require a server. It does what SSR does on build.
  • Speed (perceptive)
  • SEO (Google uses a JS crawler, but there’s more than just Google)
  • You can use react to build a static site. If you have NO interaction and JS is turned off, react-static sites will fallback to html without react.
  • Preloading! Because the data is known in advance it can also be loaded in advance.

This is a great topic, thanks for all

1 Like

This is very good - learn React in ten tweets:

1 Like

Aaaand this is very good too - sveltejs in ten tweets: