Forrest Wilkins
Forrest Wilkins

Reputation: 537

Can React-Router point directly to a route defined with Express instead of rendering a component?

How I can use React-Router to point directly to a route defined with Express on the backend instead of rendering a component? I want to return valid JSON with no HTML included in the response.

Upvotes: 0

Views: 67

Answers (1)

Queens Coder
Queens Coder

Reputation: 464

React-Router only handles routing on the React frontend.

There is no way for React-Router to point to an Express Route on the back end.

A React component would have to use that API endpoint.

Why not just hit the endpoint manually.

Upvotes: 1

Related Questions