RozenMD
RozenMD

Reputation: 344

Is it possible to run Gatsby side-by-side with a regular React single page application?

The particular use case I'm looking at is running a single page application at the root path / of a domain, and having a statically rendered blog at /blog.

I've already checked out the advice at https://www.gatsbyjs.org/docs/path-prefix/, however I'm not entirely sure how this would interact with the React app running at /

Is there a way to get React Router in the React app to support handing over to Gatsby?

Upvotes: 3

Views: 1146

Answers (1)

Kyle Mathews
Kyle Mathews

Reputation: 3278

Gatsby is just React so yes :-)

Build your SPA & blog both with Gatsby. Put the entry to your SPA at src/pages/index.js and it'll be served at /.

If you need client-only routes, you can set those up like this: https://www.gatsbyjs.org/docs/creating-and-modifying-pages/#creating-client-only-routes

Gatsby is basically CRA with some additional features to make it easy to build websites.

Upvotes: 5

Related Questions