React is a popular JavaScript library used to build modern, interactive user interfaces, especially single-page applications (SPAs). It was created by Facebook and has become widely adopted for creating reusable UI components.
import React from 'react'; function HelloWorld() { return ( <div> <h1>Hello, React!</h1> <p>Welcome to your first React component.</p> </div> ); } export default HelloWorld;
Import and render the HelloWorld
component inside your main application file (usually App.js
):
import React from 'react'; import HelloWorld from './HelloWorld'; function App() { return ( <div> <HelloWorld /> </div> ); } export default App;
To create a new React project easily, use create-react-app
CLI tool:
npx create-react-app my-app cd my-app npm start
This will start a local development server and open your new React app in the browser.
props
and manage state
.create-react-app
helps you start React projects quickly.Help others discover Technorank Learning by sharing your honest experience.
Your support inspires us to keep building!