To host React App on Firebase or Google Cloud, you must have an account with Google. Follow the below steps once you have it.
a) First, install the below npm module on the machine, where you have the deployment files or codebase. Make sure to install as root and at your project root where node_modules is present.
npm install -g firebase-tools
b) Login to google firebase
firebase login
The firebase login will open up your browser to accept credentials.
firebase init
a) Choose “Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys”
b) Select “Use an existing project”
c) Select the project created earlier in Step 2.
d) Select the appropriate options for Hosting Setup.
For React App, choose the public directory where all static files are present after running “npm run build”. In react app, it is “build” by default.
Choose yes for the single-page app question.
You can enable Automatic builds, but let’s keep it ‘No’ to start with.
You should not allow Overwrite of index.html. Select ‘No’ for that question.
We are all set now.
firebase deploy