Roots Discourse

React with Sage 9

I have a site developed with Sage 9. I want to use React on a page template for a new section that will be SPA. Is that possible?

Not going the bedrock path. :slight_smile:

I haven’t done it in a long time, so I forget the process. But yes, it’s possible.

It’s been a while since I used Sage 9, but in the past I’ve been able to get React up and running like this:

Something to note about Sage 9 is that it uses Bublé instead of Babel for compiling your ES2015+ JS, so if you run into anything React related guides that tell you to add Babel-related config, you will need to find Bublé alternatives.

For the page-specific stuff, just take advantage of Sage 9’s JS DOM-based routing.

2 Likes

Thank you for the tips guys.