is there any way to disable or speed up React PropType validation in development mode? is there any way to disable or speed up React PropType validation in development mode? reactjs reactjs

is there any way to disable or speed up React PropType validation in development mode?


Short answer: There is no simple flag to disable only PropType validation


Currently, PropType validation is enabled by __DEV__ global variable.If it's changed to false, you will lose other React warnings and errors that, as you said, you can't.

This code here in ReactDOMFactories shows how ReactElementValidator and ReactElement factories are chosen to define how an element creation will work:

function createDOMFactory(tag) {  if (__DEV__) {    return ReactElementValidator.createFactory(tag);  }  return ReactElement.createFactory(tag);}

In ReactElementValidator.createElement you can see that it calls ReactElement.createElement and then validatePropTypes:

var ReactElementValidator = {  createElement: function(type, props, children) {    /* some code here */    var element = ReactElement.createElement.apply(this, arguments);    /* some code here */    // here would be a good place for the flag that you need    validatePropTypes(element);    return element;  }

I'm not sure how this information can help you but at least shows that there is no simple way to disable PropType by a flag as you wondered.


UPDATE - 10/May/2017
Andy found that there is a Babel Plugin that removes Prop Types.
I hadn't test it. Be sure to read the Is it safe? section of the plugin to see if it fits for you.