Product Summary Component with React

Solution retrospective
I am actually proud of how I structured the project in terms of react, since this was my first time working with react properly on my own.
What challenges did you encounter, and how did you overcome them?Honestly there were no big challenges I faced since I am quite used to working with html, css, js. The only small challenge I faced was how to structure my app in terms of react components.
What specific areas of your project would you like help with?I would love to hear what others think about how I structured the app, and if it is any good.
Please log in to post a comment
Log in with GitHubCommunity feedback
- @KuvashneeNaidoo
Hi Jan! Excellent work on creating this product summary using React. For your first time using React, you nailed it! 👏👏👏
Your app is structured fairly well, and I love how you’ve defined separate components, this makes the code modular and reusable. The transformJSON function is also a clean way to handle your data. Plus, the use of the pages folder and the App.jsx file for organizing high-level page structure vs. UI components is a great best practice. This organization will make your project easier to scale and maintain as it grows.The structure is great overall!
As some stretch feedback, you can explore using props for more flexibility.
Here’s an example: The Button component currently has "Continue" hardcoded as the text. You can pass the button text as a prop to make it adaptable for different contexts.
Button.jsx
import "./Button.css"; // Function receives text as a prop export const Button = ({ text }) => { return <button className="card__button">{text}</button>; };
MainPage.jsx
// Pass values to the Button component as a prop <Button text="Submit" /> <Button text="Next" />
This is just a small insight which can make your Button component more reusable, allowing the same component to display different content based on the prop value passed to it.
Keep up the great work! Happy coding 😁
Marked as helpful
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord