Running the app
To run the sample app, first we will need to create a configuration file to set the API URL, then we can run the app using the start script:
- Create a
.env.local
file in the project root. - Add the following to the new file:
REACT_APP_STRAPI_API_URL=http://localhost:1337
.

Figure 3: Example of the .env.local file
The REACT_APP_STRAPI_API_URL
env variable points to the Strapi API we created in the book. This environment variable is referenced and used in services/api.ts
. If you are running your Strapi instance on a different machine, make sure to adjust the value of this variable to point to your Strapi application.
- Save the changes to the file, and then from the terminal run the command
yarn start
to launch the development server. Once the server is up and running, a new browser tab should atomically open. If not, open your browser and navigate to http://localhost:3000. You will be presented with the login screen: ...