GithubHelp home page GithubHelp logo

babel-react-render-defender's Introduction

Babel React Render Defender

Babel preset for react-render-defender.

What does it do?

React Render Defender lets you know when any React component has rendered twice in less than 200ms. This helps you find components which render when they really shouldn't. If a component has rendered twice in the specified time, you will see a message in the console like this:

Install

$ npm install --save-dev babel-react-render-defender

Usage

You should add this preset only for development.

Via .babelrc

.babelrc

{
  "presets": ["babel-react-render-defender"]
}

Via webpack.config.js

Example of webpackConfig file

webpackConfig.module.loaders = [{
  test: /\.(js|jsx)$/,
  exclude: /node_modules/,
  loader: 'babel',
  query: {
    cacheDirectory: true,
    presets: __DEV__
      ? ['es2015', 'react', 'stage-0', 'react-hmre', 'babel-react-render-defender']
      : ['es2015', 'react', 'stage-0']
  }
},

Additional Settings

The default threshold is 200ms. If you want to change it or go into quiet mode, do the following:

  1. In your root directory create a file called: rdefender.json
  2. In your file specify the constructor name of the component of which you want to change the threshold:
{
  "LogCallForm" : 200
}
  1. If you want to go into 'quiet mode' for a little while, add "quiet_mode": true to the file (don't forget to remove it when you are done with your heavy debugging):
{
  "LogCallForm" : 200,
  "quiet_mode": true
}

Thanks to Alex Nudelman & Boris Nadion for their help. Developed as part of my work in Samanage.

babel-react-render-defender's People

Stargazers

 avatar

Watchers

 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.