How to deploy your React app to Firebase
This article will cover how to deploy your production ready React application to Firebase
Create a Firebase application
Go to the Firebase console, login, and create your project.
Install the Firebase CLI tools
npm i -g firebase-tools
Now login from the command line terminal:
This will login using the firebase cli tools.
Now run the init command:
It will then ask you some question about what to setup.
Then choose the existing project that you have already created in the first step.
What do you want to use as your public directory?
- Enter build, or whatever folder you build into
Do you want to configure as a single page app?
- Yes, this is important to run a React app
- No, we want to keep the one Create React App created for us.
Build the application
When you are ready to deploy your application you need to build your application.
Run this command to build:
npm run build
Deploy the application
Now that everything is built we can actually deploy to Firebase.
That wraps up the course on How to build a React App. We now have deployed our app to Firebase and anyone can start using the application.