0
多くの例では、高次コンポーネントの作成方法を示すときにfunctionキーワードを使用しています。私は仕事、私たちが活字体を使用して、我々は機能キーワードを使用しないようにするにはTS-lintのルールを持っている場所で高次コンポーネント:functionキーワードとarrow関数
function logProps(WrappedComponent) {
return class extends React.Component {
componentWillReceiveProps(nextProps) {
console.log('Current props: ', this.props);
console.log('Next props: ', nextProps);
}
render() {
// Wraps the input component in a container, without mutating it. Good!
return <WrappedComponent {...this.props} />;
}
}
}
:
以下の例からは、マニュアルを参照して反応します。
だから高次コンポーネントのJSのバージョンは次のようなもののようになります。
export const collapse = (options) =>
(Trigger) =>
class C extends React.Component {
}
質問です:どんな違いがあり、機能のキーワードで構文を使用するための任意のメリットがありますか。