Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 3 months ago

Product Summary Component with React

react
P
Jan Kotvaš•440
@DrakeHermit
A solution to the Results summary component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What are you most proud of, and what would you do differently next time?

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.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Kuvashnee Naidoo•450
    @KuvashneeNaidoo
    Posted 3 months ago

    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
Frontend Mentor logo

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub