1

I'm using Express framework on NodeJS (hosted by Heroku) to create my web site. I'm also using the React framework to create my components.

I have several HTML files with divs inside and React components which can be rendered in those divs.

When a user chooses a route (e.g. /movies) I want to be able to associate one HTML file with a component and return it back to the user. I already looked for a solution, but all of them talk about server-side rendering and sending back HTML files.

Is there another solution?

1
  • Would you be able to give more details why you need more html files? Usually if you don't want to do server-side routing one HTML file serving as a container is enough, all the other views can be rendered straight from the Javascript Commented Mar 29, 2015 at 15:20

2 Answers 2

8

Check out react router you don't have to use server side rendering, you just need to give a react component that you want to return when a route is requested.

Sign up to request clarification or add additional context in comments.

1 Comment

Would appreciate a link to good reference material. This link goes to a git project that has no documentation on how to use it.
2

The standard way to do this now is to build a Single-Page applications and redirect all requests to /, and the front end routing will handle the required page to load.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.