Enhancing the basic React app
In the Installing NodeJS for frontend development section of Chapter 1, Setting Up Our System for Development, we used the create-react-app
tool to create a standard React app, which we can now configure for our usage.
First, as we are using a frontend development server, we will need to proxy API requests to our backend by adding the following to frontend/package.json:
{ ..., "proxy": "http://localhost:5050" }
The highlighted ellipsis represents the existing code; note the additional trailing comma that has been added.
Next, we’ll configure the import system so that we can use full paths with src as the root (i.e., src/components/Component) rather than, for example, ../components/Component. This makes the imported file easier to find as we can always relate the path to the src directory. It also matches the type of import paths we’ve used already in the backend. To do so, we need to...