雨果与反应?
原标题:Hugo with React?
Is it possible/ideal to use something like Hugo with React?
I am aware of Gatsby, but would Hugo work as well?
I have limited knowledge of combining the two, but my understanding would be that:
Hugo would be used for all your templating and static web pages and,
React would be used for the web application type of things, and a headless CMS somewhere in there?
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?
最佳回答
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:
Use gatsby to build the page. You should build each page of your website on its own (dont rely on the routing)
Use the index.html file with hugo templates.
Done
This is the picture of folder public (the output) after building gatsby page:
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.
问题回答
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.
相关问题
Why am I receiving a Cannot read properties of null (reading studentId ) error in my code when trying to update data in a React CRUD app?
This is my first question, and english is not my first language, sorry if my question is hard to understand
I was trying to make simple CRUD app with mysql database and react as the frontend, and i ...
How to use one react app into another react app?
I have two react apps, parent app and child app. and child app have an hash router.
I have build the child app using npm run build, It creates build folder.
That build folder moved into inside the ...
我如何利用Params(Params)在React的初期阶段进行过滤,而不是提出另一个要求?
这是我的第一个问题,请与我一起回答。 I m从事一项SPA React项目,该项目跟踪农场及其相关床位,并可使用一些帮助。 我愿就......提供一些数据。
how to get selected value in Ant Design
I want to print the selected value, and below is my option list:
const vesselName = [
{
value: 0 ,
label: ALBIDDA ,
},
{
value: 1 ,
label: ALRUMEILA ,
},
{
value: 2 ,...
why custom filter reset button is not working for antd filterdropdown in table?
I have this custom filter for date , filter button is working as expected but reset button is not working, can anyone help me,what s wrong here?
Below is my code which contain handlesearch,handlereset ...
How to add a <br> tag in reactjs between two strings?
I am using react. I want to add a line break <br> between strings
No results and Please try another search term. .
I have tried No results.<br>Please try another search term.
but ...
React DnD - "Cannot have two HTML5 backends at the same time."
I am trying to make a POC with Rails5, action Cable, React and Rails and React DnD.
The purpose is to make an app like trello but for an recruitment process.
My front is in ReactJS.
I have 3 ...