babel-plugin-react-add-data-id
v2.0.2
Published
Adds React properties
Downloads
10
Maintainers
Readme
Installation
npm install --save-dev babel-plugin-react-add-data-id
Example
class Example extends React.Component{
render(){
return (
<MyComponent>
component
</MyComponent>
)
}
}
out
class Example extends React.Component{
render(){
return (
<MyComponent data-id="node-1">
component
</MyComponent>
)
}
}
Usage
.babelrc
{
"plugins": ["react-add-data-id"],
"presets": ["react","env"]
}
webpack.config.js
'module': {
'loaders': [{
'loader': 'babel-loader',
'test': /\.js$/,
'exclude': /node_modules/,
'query': {
'plugins': ['react-add-data-id'],
...
}
}]
}