Creating a simple React app for your website’s landing page can be an effective way to engage your visitors with a dynamic and interactive user interface. This guide will walk you through the process of setting up a basic React application using Create React App, and then customizing it to serve as a landing page.
Step 1: Setting Up Your Development Environment
Before you start, ensure you have Node.js and npm (Node Package Manager) installed on your computer. You can download them from the official Node.js website.
Install Create React App
Create React App is a comfortable environment for learning React, and is the best way to start building a new single-page application in React.
Open your terminal and run the following command to install Create React App globally:
npm install -g create-react-app
Step 2: Creating a New React App
Once Create React App is installed, you can create a new React project. Navigate to the directory where you want to create your project and run:
npx create-react-app my-landing-page
Replace my-landing-page with whatever name you want to give your project. This command will create a new directory called my-landing-page with all the necessary files and dependencies.
Step 3: Running Your React App
Navigate into your new project directory:
cd my-landing-page
Then, start the development server:
npm start
Your default browser should automatically open and display your new React app at localhost:3000.
Step 4: Customizing Your Landing Page
Now, let’s customize the landing page. Open the src/App.js file in your preferred code editor. You’ll see the default React app code. Replace it with the following to create a simple landing page:
import React from 'react';
import './App.css';
function App() {
return (
<div className="App">
<header className="App-header">
<h1>Welcome to My Website</h1>
<p>Explore the world of possibilities with us.</p>
<button>Learn More</button>
</header>
</div>
);
}
export default App;
Styling Your Landing Page
To style your landing page, open the src/App.css file and add the following CSS:
.App {
text-align: center;
}
.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
button {
font-size: 1em;
padding: 10px 20px;
background-color: #61dafb;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #4fb3d4;
}
Step 5: Building Your App for Production
Once you’re satisfied with your landing page, you can build it for production. Run the following command in your terminal:
npm run build
This command will create an optimized build of your app in the build folder, ready to be deployed to your web server.
Conclusion
You’ve now created a simple React app for your website’s landing page. This basic setup can be further customized with additional components, animations, and features to meet your specific needs. Happy coding!






