Socket
Book a DemoInstallSign in
Socket

react-debug

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-debug

Debug module for react classes

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

react-debug

NPM version build status Test coverage Downloads

Debug module for react classes. Calls debug under the hood with the namespace set based on the displayName property of your class.

Installation

npm install react-debug

Usage

var debug = require('react-debug');
var react = require('react');

react.createClass({
  displayName: 'myClass',
  getInitialState: getInitialState,
  render: render
});

function getInitialState() {
  return {
    foo: 'bar',
    bin: 'baz'
  }
}

function render() {
  debug(this, 'render', this.state);
  // => class:myClass render [object]
}

Debug

To enable react-debug in the browser type in the console:

localStorage.debug = '*';

API

debug([ctx], msg)

Pass in a context to retrieve the displayName property from the react class. If no context is provided we default to just using class.

debug(react.createClass({displayName: 'baz'}), 'foobar');
// => class:baz foobar

debug('barbar');
// => class barbar

License

MIT

Keywords

react

FAQs

Package last updated on 08 Oct 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts