Great article!
Harshal Ringe
281

Hey there,

Sorry for the delay, just saw this.

I’m a little confused about why you need to push code to a development server to see changes… The typical flow is that you use Create React App to compile on file-save, so you can view the code in less than a second.

I’ve worked with “staging” servers, but we typically push to them only once in a while, as a way to test final changes before they go live. In that case you just compile your changes, which can take a minute or two for large projects, and then just push your changes to the server, using FTP or whatever. But you shouldn’t have to do that for every change!

In development, ideally you want the entire stack to be running locally (so, webpack runs the front-end React app, but you also have your own copy of the back-end server running on a different port). That way, the front-end can make API requests to the local back-end server. To get around cross-origin issues, Create React App lets you proxy requests

There’s a bit of info about working with a local API, but yeah this is assuming your back-end doesn’t manage any front-end rendering. Which is the way most folks recommend setting it up, but probably quite different from what you’re used to, with PHP generating the HTML.

But yeah, afraid I’m not an expert in this; I’ve done quite a bit with Node, and a bit with a Rails API, but I’ve never worked with React and a traditional server-rendered application.

Best of luck!

Like what you read? Give Joshua Comeau a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.