私は基本的に、彼らはデコレータでそれを返す前に、コンポーネントにpropTypesを追加 PropTypes on Higher Order Components高次コンポーネントのPropTypesは本番環境で削除されますか?
ために、この例を見つけました。以下のコードのコピーを参照してください。
私が知っているのは、反応ストリップのPropTypesのビルドビルドですが、以下のような内部機能からそれを取り除くのでしょうか?
function EnhanceButton(Component) {
class _EnhancedButton extends React.Component {
render() {
return (
<Component { ...this.props }>{this.props.children}</Component>
);
}
}
_EnhancedButton.propTypes = Component.propTypes;
return _EnhancedButton;
}
ああ、説明をいただきありがとうございます。 –