Socket
Socket
Sign inDemoInstall

babel-react-render-defender

Package Overview
Dependencies
3
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    babel-react-render-defender

Babel render defender


Version published
Maintainers
1
Install size
1.40 MB
Created

Readme

Source

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.

FAQs

Last updated on 14 Jul 2016

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc