Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 1 year ago

QR component | ReactJS | Vite

accessibility, react, vite
Mayank Arora•430
@mayankdrvr
A solution to the QR code component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Hi Frontendmentor community,

This is my QR component beginner challenge solution in ReactJS. I had previously submitted a vanilla JS solution of the same challenge and had learned a lot from the feedback i had received. Initially, i was having trouble loading the image in my project. I learned that it is a good practice to put static image files in the src folder instead of the public folder and the src attribute in the <img> element in React component uses a 'require' keyword in case the image files are in src folder.

An issue i found in this submisson is that below 318px width of screen, the container and image do not resize and the text does not wrap. According to my understanding, max-width styling property is not working as designed. Also, the HTML validation report is showing the following errors on the challenge submission page on FEM-

ERROR
Element "meta" is missing one or more of the following attributes: "content", "itemprop", "property".
en"><head><meta charset="UTF-8"><meta
ERROR
A document must not include more than one "meta" element with a "charset" attribute.
en"><head><meta charset="UTF-8"><meta
ERROR
Attribute "name" not allowed on element "meta" at this point.
t="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><link
ERROR
Element "meta" is missing one or more of the following attributes: "itemprop", "property".
t="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><link
ERROR
Element "title" not allowed as child of element "div" in this context. (Suppressing further errors from this subtree.)
ylesheet"><title>Fronte
ERROR
Stray end tag "head".
tyle.css"></head><body>
ERROR
Start tag "body" seen but an element of the same type was already open.
s"></head><body><main
ERROR
End tag for "body" seen, but there were unclosed elements.
></footer></body></html
ERROR
Unclosed element "div".
id="root"><div class="App"><html
ERROR
Unclosed element "div".
/noscript><div id="root"><div c
ERROR
Stray end tag "div".
y></html> </div></div>

Do you think these errors are due to me uploading the build folder in ReactJS to netlify deployed site using drag and drop method as i saw that the files in the build folder have continous text without any line break or spacing? I would be highly grateful if someone could guide me to rectify these issues.

I request the community to review and give feedback for the live site and the shared source code on the following parameters-

  1. Does it follow all the good web accessibility practices?
  2. Is the site mobile first and responsive on all devices?
  3. Do you have any other code refactoring suggestion with respect to ReactJS best practices?

Please feel free and do not hesitate to review my code and do give feedback for improvement. All suggestions are welcome. Waiting to learn from your feedback and experience. Thank you for reviewing my challenge submission.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Mayank Arora•430
    @mayankdrvr
    Posted over 1 year ago

    UPDATE:

    1. I have refactored this challenge using Vite as Create React App(CRA) is deprecated.
    2. All issues resolved in Accessibility report & HTML validation report on challenge submission page on FEM.
    3. The styling has been updated according to the feedback received on FEM discord to make the site responsive.
    4. Source code and preview site has been updated.

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