score:9

Accepted answer

yeah,
there is component web design in gatsby,
and there is the light speed of hugo,

i am stuck in the decision between these too.

i dont know what i will do but what is on my mind is this:

  1. use gatsby to build the page. you should build each page of your website on its own (dont rely on the routing)
  2. use the index.html file with hugo templates.
  3. done

this is the picture of folder public (the output) after building gatsby page:
enter image description here

update:

you can rely on the routing. in the picture above, each of the component folders have index.html of its own so you can use them too.

update 2021:

use next.js. with incremental static regeneration feature you can achieve what you want without even touching hugo.

score:7

is it possible/ideal to use something like hugo with react? i am aware of gatsby, but would hugo work as well.

we used hugo with react (create-react-app) at https://www.electrade.app. all pages serve to hugo static pages, but if you navigate to /quote, the react spa loads and you're in dynamic land. so yes, hugo works as well, but you'll have 2 languages and 2 syntaxes.

combining the two [...] my understanding would be that hugo would be used for all your templating and static web pages and then react would be used for the web application type of things

exactly.

can someone with experience comment why hugo or gatsby are sometimes good to use with react? or an overview of the relationship between the frameworks?

  • hugo is written in go and builds vanilla static html. example: a blog, but you only need to write the header and footer once.
  • react is written in javascript and is a front-end library to build dynamic interfaces. a react site will usually serve you an empty index.html file and a javascript file, which will then run and fill the index.html file with content dynamically in your browser. example: facebook newsfeed that's different every time it loads.
  • but what if you want to write the example blog above, also only writing the header and footer once, but are used to react syntax? if you use normal react, your blog will download an empty index.html file and fill it with your blog in javascript. this is not good for seo and load times, among other things. if you want to still have it compile down to vanilla static html – that's what gatsby is for.

Related Query

More Query from same tag