GithubHelp home page GithubHelp logo

gaearon / react-transform-debug-inspector Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alexkuz/react-transform-debug-inspector

2.0 2.0 1.0 102 KB

React inspector tranformation function for babel-plugin-wrap-react-components

License: MIT License

JavaScript 100.00%

react-transform-debug-inspector's Introduction


React inspector tranformation function for babel-plugin-react-transform

(this feels like more of a demo than a real thing for now, but anyway)


$ npm i -D react-transform-debug-inspector

Update your .babelrc:

  "plugins": ["babel-plugin-react-transform"],
  "extra": {
    "babel-plugin-react-transform": [{
      "target": "react-transform-debug-inspector"

If you need advanced settings, add path to config module:

  "extra": {
    "babel-plugin-react-transform": [{
      "target": "react-transform-debug-inspector",
      "imports": ["./debug/inspectorConfig"]

Config example:

// import styles for json tree
import 'style!css!react-object-inspector/react-object-inspector.css';

function getMyPanel(component) {
  // custom components are allowed
  return <h1>This is a {}</h1>;

let _enabled = false;

export default {
  // add your custom panels ('props', 'state', 'context' by default)
  getPanels: defaultPanels => [{
    name: 'myPanel',
    getData: getMyPanel
  }, ...defaultPanels],

  // enable or disable inspector with key binding or whatever
  enabledTrigger: enable => {
    window.addEventListener('keydown', e => {
      if (e.keyCode === 49 && e.metaKey) {
        _enabled = !_enabled;
    // another example: enable('debug') !== -1)

  // filter components that don't need inspector
  showPin: component => true

react-transform-debug-inspector's People


alexkuz avatar


 avatar  avatar


 avatar  avatar



Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.