Get the React equivalent of any native HTML attribute
npm install html-attribute-to-reactGet the React equivalent of any native HTML attribute.
class in HTML becomes className in Reactaria- and data-* attributes stay the sameIf you need to programmatically convert HTML to React, this package handles the attribute conversion for you.
yarn add html-attribute-to-react --save
`Usage
`js
import htmlAttributeToReact from 'html-attribute-to-react';htmlAttributeToReact('class');
// returns 'className'
htmlAttributeToReact('tabindex');
// returns 'tabIndex'
htmlAttributeToReact('aria-label');
// returns 'aria-label'
htmlAttributeToReact('some-custom-attribute');
// returns 'some-custom-attribute'
`To get the full attribute map:
`js
import { attributes } from 'html-attribute-to-react';attributes['class'];
// 'className'
``