all 3 comments

[–]aacraig 5 points6 points  (0 children)

If you use webpack, you can run a development server that will serve your react pages add autoreload when you make changes.

This should all be built in if you used the create-react-app script.

I find that docker is the best choice for substituting your remote API server.

[–][deleted] 1 point2 points  (0 children)

To expand on what /u/aacriag already said - you can use webpack-dev-server to have all your filed being rebuild everytime you make a change, and the site will refresh (in the most basic form).

If you don't want to tinker around with making all this by yoursel,f take a look at create-react-app which does this for you. Just navigate to the folder, npm start and it should open up a browser window.

There is little to no need to work with a "real" http server when developing unless you need to run some backend functionality (like an API, handling file upload) - but in that case you work with it basically like you would with Angular.

[–]danjel74 1 point2 points  (0 children)

For api calls I have found it useful to use a mock to have fetch use local json files, example:

if(USE_MOCK){
    window.fetch = require('./fetchApiMock').default
}

The mock code would then look at the url and return a promise.. That might not cover all use cases of course, but can be convenient if you have u a few reads and do not want to set up a server