npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

babel-react-render-defender

v1.1.1

Published

Babel render defender

Downloads

23

Readme

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.