How does the front-end compile React components into Golang's HTML template?

Viewed 103

I see that the front-end of the project uses ReactJS, and there are also some HTML templates in the template folder that can be used by Golang.

Is this project converting React pages into HTML templates first, embedding these templates into the Go binary, and then performing server-side rendering?

If so, how is the conversion of React pages to HTML templates implemented?


我看到项目的前端用的是reactjs, template文件夹里面也有一些可以给golang使用的模板html
请问这个项目是先将react的页面转换成html模板然后把这些模板嵌入到go的二进制然后进行服务端渲染的吗
如果是的话那么是怎样实现将react的页面转换为html template的呢?

1 Answers

There is no conversion, the templates page is just for SEO, because we don't want to enable a node-type service for SEO, as you can see from the code, he template file just stays the same as what react renders afterwards, slightly inconsistent in structure.