Skip to content

Instantly share code, notes, and snippets.

@ethan-deng
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ethan-deng/f35fd643fe0dc73c24b0 to your computer and use it in GitHub Desktop.
Save ethan-deng/f35fd643fe0dc73c24b0 to your computer and use it in GitHub Desktop.
React Custom HTML Attributes must be data-xyz and all lowercase

##React Custom HTML Attributes must be data-xyz and all lowercase

React Document:

Custom HTML Attributes

If you pass properties to native HTML elements that do not exist in the HTML specification, React will not render them. If you want to use a custom attribute, you should prefix it with data-.

Beside this the attribute name must all lowercase

<div data-uniqueName={myVar}>Hello World</div>

is invalid.

<div data-uniquename={myVar}>Hello World</div>

is valid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment