Skip to content

🔍 Identifies react components and adds an attribute to them with their identifier

Notifications You must be signed in to change notification settings

bbohen/babel-plugin-component-identification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

babel-plugin-component-identification


Identifies react components and adds a data-component-id to them with their identifier, this was made with the intention of aiding automated testing through easier DOM selectors and should not be used in production.

<div data-component-id="ExampleComponent">I am component</div>

This plugin identifies a component if it detects:

  • An instance of a class with a render method that returns JSX
  • A function that returns JSX

Install

npm install --save-dev babel-plugin-component-identification

Usage (.babelrc)

{
    "plugins": ["component-identification"]
}

About

🔍 Identifies react components and adds an attribute to them with their identifier

Resources

Stars

Watchers

Forks

Packages