James Maa
James Maa

Reputation: 1794

Can we combined express with react.js?

I am wondering if we are able to combine express.js with React.js, specifically with templating.

I have tried several packages like express-react, either it is giving up react and it's webpack features, or it is giving up templating that allows me to customize rendering based on user's information.

Do we have a easier method to render react on an express server? And supporting templating in an express fashion?

Upvotes: 0

Views: 183

Answers (1)

squgeim
squgeim

Reputation: 2351

React is a library for build views in a Single Page Application (SPA). A SPA, by definition only has one page served from the server. You can think of this page as the page you build in express with templates.

Express is only used as an API server for a React SPA.

What you may be looking for, though, might be server side rendering a React App, but this is an advance topic even after you are familiar with React:

https://github.com/reactjs/redux/blob/master/docs/recipes/ServerRendering.md

Upvotes: 1

Related Questions