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

React-Vite-Typescript Scss flexbox grid framer-motion redux-toolkit

react, sass/scss, typescript, vite, redux-toolkit
Aryan Tirkey•170
@AryanTy20
A solution to the E-commerce product page challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


first time trying with typescript any suggestions ?

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Anton•515
    @antarya
    Posted almost 3 years ago

    Hi 👋,

    Nice job 🚀. I noticed a couple of things that can be improved.

    HTML

    [1. Use button tag instead of div tag for icon buttons, and do not forget to add aria-label for buttons with no text.

    • https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label

    [2. Usually, the logo is a link to the home page with an alt property set to the app name.

    [3. Check responsiveness on screen size e.g. 692px.

    JS/React/Typescript

    [4. Typescript looks good; when possible, create reusable types, e.g.:

    interface Image {
      poster: string;
      thumbnail: string;
    }
    

    And use it whenever this type is used.

    [5. If you use hard-coded data, move it out of the component, nothing is happening with it while rendering. A better approach would be to imitate fetch using a slight delay with a loading indicator to mimic the real application.

    [6. The first parameter of the array splice method is the index at which to start changing the array. Using id to remove the item from the cart as the first parameter of splice will not work correctly. 

    • https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice

    [7. You can skip <>...<> as the root element when there is only one child element.

    [8. Use the header tag as a root element of the Header component instead of wrapping the Header component in App.

    [9. In Cart component you check if cart is empty several times, it is a good candidate to have it in a variable e.g. const isPresent = data?.length > 0.

    [10. useState<boolean>(false) you can skip type here if you expect the value to be only boolean as typescript will know.

    [11. NavLinks will probably be reused in other places .e.g in the footer, so keep it outside the component and/or move it to its file.

    General

    [12. Use reset to have a good starting point, e.g. https://piccalil.li/blog/a-modern-css-reset/.

    [13. For commit messages, it will help others if you add a descriptive message and follow a specific format, so all is consistent https://www.conventionalcommits.org/en/v1.0.0/. You can even make a check before committing if you follow those rules by using a tool like commitlint - https://commitlint.js.org/#/

    Let me know if you have questions. I hope this will be helpful.

    Keep up the good work 🚀. Cheers!

    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

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