PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, October 15, 2022

[FIXED] How can I add html Element Attributes in react

 October 15, 2022     dom, html, reactjs     No comments   

Issue

How can I add an attribute to html element in React js. I want to set <html lang="en"> to solve WCAG Level A validation issue.

I added html-element-attributes module but no idea about how to use it.

Anybody please help to get a way to add this lang attribute to html element?


Solution

you need React helmet for this. Put this block in any top level component's render:

<Helmet>
  <html lang="en" />
</Helmet>


Answered By - Fawaz
Answer Checked By - Clifford M. (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

1,216,187

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © 2025 PHPFixing