0% found this document useful (0 votes)
11 views1 page

User Details

The document contains a React component called UserDetails that retrieves and displays user information based on a user ID from the URL parameters. It uses the useParams hook to extract the userId and finds the corresponding user data from a usersData array. The component renders the user's name, email, username, and phone number in a structured format.

Uploaded by

KundiLokesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views1 page

User Details

The document contains a React component called UserDetails that retrieves and displays user information based on a user ID from the URL parameters. It uses the useParams hook to extract the userId and finds the corresponding user data from a usersData array. The component renders the user's name, email, username, and phone number in a structured format.

Uploaded by

KundiLokesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import React from "react";

import { useParams } from "react-router-dom";


import userData from "./usersData";

function UserDetails() {
const { userId } = useParams();

const userDetailsData = userData.find((eachUser) => eachUser.id == userId);

return (
<div>
<h1>UserDetails</h1>

<h2>{userDetailsData.name}</h2>
<h3>{userDetailsData.email}</h3>
<h3>{userDetailsData.username}</h3>
<p>{userDetailsData.phone}</p>
</div>
);
}

export default UserDetails;

You might also like