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 then 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?
Hugo, that I use for my static site, does not directly have support for transpiling React. But with a few small steps you can make React transpiling as a part of your Hugo build and use React for your user experiences.
Hugo Pipes can process JavaScript files with ESBuild. Any JavaScript resource file can be transpiled and “tree shaken” using js. Build which takes for argument either a string for the filepath or a dict of options listed below.
React is amazing not only because it's blazing fast but also most importantly for its component-based architecture. When using a CMS, React unleashes all its power mainly because of this architecture since the developer will design and develop really reusable components.
React will call the ref callback with the DOM element when the component mounts, and call it with null when it unmounts. Refs are guaranteed to be up-to-date before componentDidMount or componentDidUpdate fires.
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?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With