-
-
Notifications
You must be signed in to change notification settings - Fork 768
London10_Jan_Softa_cyf_hotel_react #615
base: master
Are you sure you want to change the base?
Conversation
Kudos, SonarCloud Quality Gate passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks great Jan! I added a couple of comments.
|
||
const App = () => { | ||
const contactDetails = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move the contactDetails inside the Footer component? I don't think there is a need to define contactDetails here and pass it to the Footer component as props
import Search from "./Search.js"; | ||
// import SearchResults from "./SearchResults.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove if not used
|
||
useEffect(() => { | ||
setIsLoading(true); | ||
fetch(`https://cyf-react.glitch.me/customers/${props.id}`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Bookings.js you use async, await to do the fetch, while here you use .then() (i.e. promises chaining). I suggest using async, await here as well to make sure the code is consistent.
|
||
if (!customerProfileData) { | ||
return null; // or render a message indicating that the customer profile is not available | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[no action] It's nice you're separating the different return statements and not putting them all into one big return.
/> | ||
<button className="btn btn-primary">Search</button> | ||
<SearchButton /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel that putting the button into a separate SearchButton component is over-engineering. The component only has a single line to declare a button and doesn't maintain any state. What do you think of just inlining the here?
) : ( | ||
<OutcomeSearch results={bookings} setCustomerId={setCustomerId} /> | ||
)} | ||
{customerId && <CustomerProfile id={customerId} />} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is using the CustomerProfile component here needed? I see that you render the CustomerProfile component in the SearchResult.js line 54.
I think customerId is always undefined and thus it never renders the component here. Please take a look and let me know what are your thoughts on this. Thanks
No description provided.