How to host your ReactJs project on firebase.
Before explaining the process I am assuming that you have a firebase account set up. If not please set up an account and install the Firebase CLI.
- Firebase CLI: https://firebase.google.com/docs/cli?authuser=0#linux
- Go into the project directory and run these commands in the given order.
2. After running the above command choose the Firebase Hosting option. (Not the GitHub one)
3. So if you have created a project on the Firebase then choose the existing project else go with the appropriate one.
4. Select the Project name if you have one in the Firebase.
Now the most important step where most developers mess up.
- you have to write build as your public directory.
- Then you have to say yes cause you are using react which is SAP.
You are almost done.
Need to run these two commands in order to deploy your React App.
- npm run build (this will bundle up all the static data inside the build folder)
- firebase deploy ( A single command :) to deploy your application)