When using react in real world projects is it rendered in server side?


At the moment I can create react apps, get content from APIs and all that good stuff. Recently I say a tutorial where react is rendered through express:

const app = express();


app.get('*', (req,res)=>{
	res.send(`<!DOCTYPE html>
<html lang="en">
  <meta charset="UTF-8">
  <script src="/bundle.js" defer></script>
  <div id="root">${renderToString(<App />)}</div>

Is this the approach professionals take or do they just create react apps (kind of starting with create-react-app) and just reaching for an API,

What I'm trying to figure out is, I am going to learn how this works just to say I played with it, but is this the approach I should use every time I create react apps?


Every react project you encounter will be different since react imposes few architectural decisions on developers who use it. This is one of the selling points of react over the strict, rigid structural architecture of angular. If you are building a large application with react you will ultimately end up creating your own framework and everyones is going to be different.


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.