Facebook Pixel

Navbar

React.js
easy
25 mins

Create a simple React application with a navigation bar and two pages using React Router v6. The app should include:

  • A Navbar with links to Home and About pages
  • Separate components for Home and About pages
  • Proper routing such that clicking a link changes the content shown without refreshing the page

Requirements:

  1. Use React Router v6 Use react-router-dom to define and manage your routes.

  2. Navbar

    • Use the NavLink component from react-router-dom.

    • Should contain two links:

      • Home → Navigates to /
      • About → Navigates to /about
  3. Home Page (Home.js)

    • Route: /
    • Content: Welcome to the Home Page
  4. About Page (About.js)

    • Route: /about
    • Content: Welcome to the About Page
  5. App Component (App.js)

    • Should use BrowserRouter, Routes, and Route from react-router-dom.
    • Render Navbar and show Home or About based on the current route.

Reference UI

navbar

Preview what you need to build

Companies:

salesforce

Solve Similar questions 🔥

Please Login.
Please Login.