This repository has been archived by the owner on Feb 9, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 767
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
20. Displaying a customer profile - step 1
Added a new column in the table of the <SearchResults /> component and displayed a <button> for each row. The text of the button should read "Show profile". Then, created a new <CustomerProfile /> component. This component is rendered next to the table in the <SearchResults /> component. This component receives one prop id. When clicking on a "Show profile" button for a given row, the component <CustomerProfile /> displays the text "Customer Profile", where the id of the selected customer is. Initially, the <CustomerProfile /> component doesn't show anything. Hint: We need to record the selected customer id after clicking on a "Show profile" button. In which component do we think this state should be defined? Tested: When first showing the page, no customer profile is displayed. When clicking the first "Show profile" button of the table, the text "Customer 1 profile" appears. When clicking the second "Show profile" button of the table, the text "Customer 2 profile" appears instead.
- Loading branch information
Showing
3 changed files
with
60 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from "react"; | ||
|
||
const CustomerProfile = ({id}) => { | ||
return ( | ||
<p>Customer {id} Profile </p> | ||
) | ||
} | ||
|
||
export default CustomerProfile; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters