🎓 Top 15 Udemy Courses (80-90% Discount): My Udemy Courses - Ramesh Fadatare — All my Udemy courses are real-time and project oriented courses.
▶️ Subscribe to My YouTube Channel (178K+ subscribers): Java Guides on YouTube
▶️ For AI, ChatGPT, Web, Tech, and Generative AI, subscribe to another channel: Ramesh Fadatare on YouTube
In this tutorial, you will learn how to create a new React App and deploy it to Heroku cloud.
Heroku is a platform as a service (PaaS) that enables developers to build, run, and operate applications entirely in the cloud.
Video
As usual, in this tutorial, we will learn how to create and deploy React App step by step.
Steps
Here are the steps:
1. Create React HelloWorld App
2. Host source code of React App on GitHub
3. Login to Heroku and create a new app in Heroku
4. Adding a buildpack
5. Connecting GitHub repository to Heroku app
1. Create React HelloWorld App
npx create-react-app react-app-herokucd react-app-herokuimport React, { Component } from 'react'; class App extends Component { render() { return ( <div className="App"> <h1>Hello World!</h1> </div> ); } } export default App;
npm startRuns the app in development mode. Open http://localhost:3000 to view it in the browser.
2. Host Source Code of React App on GitHub
Here, we’ll be creating a fresh GitHub repository and pushing our app to it.
Login to your GitHub account and create a repository as "react-app-heroku".
You can use Git to push source code of newly created React App to this GitHub repository using the following commands:
git remote add origin <new_github_repository_url>
git add .
git commit -m "initial commit"
git push -u origin master
Now our app is on GitHub.
3. Login to Heroku and Create a New App in Heroku
Now it's time to login to Heroku to deploy our React app to Heroku cloud.
Go ahead and login to Heroku and create a new app like:
4. Adding a buildpack
5. Connecting GitHub repository to Heroku app
Next, navigate back to the Deploy tab. Scroll down to the deployment method section and choose GitHub.
Now you can choose any branch you want to deploy. For this example, I have selected the main branch.
Now you can click on the Deploy Branch button to initiate deployment. Heroku will start fetching and installing packages.
Once the deployment is finished, you will get an update that tells you that your app was successfully deployed on https://react-application-heroku-demo.herokuapp.com:
Related Deployment Tutorials
My Top and Bestseller Udemy Courses. The sale is going on with a 70 - 80% discount. The discount coupon has been added to each course below:
Build REST APIs with Spring Boot 4, Spring Security 7, and JWT
[NEW] Learn Apache Maven with IntelliJ IDEA and Java 25
ChatGPT + Generative AI + Prompt Engineering for Beginners
Spring 7 and Spring Boot 4 for Beginners (Includes 8 Projects)
Available in Udemy for Business
Building Real-Time REST APIs with Spring Boot - Blog App
Available in Udemy for Business
Building Microservices with Spring Boot and Spring Cloud
Available in Udemy for Business
Java Full-Stack Developer Course with Spring Boot and React JS
Available in Udemy for Business
Build 5 Spring Boot Projects with Java: Line-by-Line Coding
Testing Spring Boot Application with JUnit and Mockito
Available in Udemy for Business
Spring Boot Thymeleaf Real-Time Web Application - Blog App
Available in Udemy for Business
Master Spring Data JPA with Hibernate
Available in Udemy for Business
Spring Boot + Apache Kafka Course - The Practical Guide
Available in Udemy for Business



Comments
Post a Comment
Leave Comment