componentpath-react-mixin

1.0.1 • Public • Published

componentpath-react-mixin

NPM

React mixin to add data attribute to component element containing path to source file. Very useful for QA and debugging code at runtime, particularly UI issues.

Installation

npm install componentpath-react-mixin

Usage

Require the mixin into your component and pass in the file path using the node '__dirname' variable:

var ComponentPathMixin = require('componentpath-react-mixin')(__dirname);

Then include the mixin as normal:

mixins: [ComponentPathMixin]

You can also pass context into your component path to differentiate between different insatnces of the same component. Just pass a 'componentContext' property into your component:

<ReactElement componentContext="context" />

Release History

0.0.1 Initial release 0.0.2 Created tests 0.0.3 Completed readme 1.0.0 Released to NPM 1.0.1 Added NPM badge to readme

Package Sidebar

Install

npm i componentpath-react-mixin

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • scriptic