0% found this document useful (0 votes)
9 views

React App Setup

The document describes how to create a new React app using Create React App, including generating a new project, adding a Navbar component with a brand name and button, and passing a callback function to handle button clicks.

Uploaded by

Ramesh K
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

React App Setup

The document describes how to create a new React app using Create React App, including generating a new project, adding a Navbar component with a brand name and button, and passing a callback function to handle button clicks.

Uploaded by

Ramesh K
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Here's an example of a web application using Create React App that meets the requirements you

provided:

To create a new Create React App project, open your terminal and run the following command:
Copy code
npx create-react-app my-app
cd my-app

Next, we'll create a Navbar component that displays the brand name and a "Get Users" button.
Create a new file called Navbar.js in the src/components folder with the
following code:

javascript
Copy code
import React from 'react';

const Navbar = ({ onGetUsersClick }) => {


return (
<nav className="navbar">
<span className="navbar-brand">Brand Name</span>
<button className="btn btn-primary" onClick={onGetUsersClick}>
Get Users
</button>
</nav>
);
};

export default Navbar;

You might also like