You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We want to strip the code that implements PropTypes validation functions in production. This doesn’t mean React.PropTypes won’t exist—just that the functions will throw in production every time.
I did an initial attempt at this in #6401 but it’s too much of a change because people might be calling PropTypes in production right now for introspection, and we’d need to deprecate calling them in production before actually turning them into shims that throw errors.
@spicyjsuggested a good first step: we should pass an extra argument to propType checkers. We would warn if that argument is not passed (or, if passed, does not match our “secret” value). This way we can detect if somebody manually calls PropTypes validators, and warn with console.error in production.
If you’d like to work on this, please comment here so we don’t have many people implementing this at the same time. You would need to:
Pass an extra argument to prop type checkers.
In production, warn inside the prop type checkers if they don’t receive the expected extra argument.
The warning should say something like You are manually calling React.PropTypes validation functions in a production build. This is deprecated and will not work in the next major version.
We want to strip the code that implements PropTypes validation functions in production. This doesn’t mean
React.PropTypes
won’t exist—just that the functions will throw in production every time.I did an initial attempt at this in #6401 but it’s too much of a change because people might be calling
PropTypes
in production right now for introspection, and we’d need to deprecate calling them in production before actually turning them into shims that throw errors.@spicyj suggested a good first step: we should pass an extra argument to propType checkers. We would warn if that argument is not passed (or, if passed, does not match our “secret” value). This way we can detect if somebody manually calls
PropTypes
validators, and warn withconsole.error
in production.If you’d like to work on this, please comment here so we don’t have many people implementing this at the same time. You would need to:
You are manually calling React.PropTypes validation functions in a production build. This is deprecated and will not work in the next major version.
The text was updated successfully, but these errors were encountered: