1
私は、Reactの過去のバージョンでは、このようなサブコンポーネントを作成できることを知っています。React ES6のサブコンポーネント
var MyFormComponent = React.createClass({ ... });
MyFormComponent.Row = React.createClass({ ... });
MyFormComponent.Label = React.createClass({ ... });
MyFormComponent.Input = React.createClass({ ... });
しかし、React ES6でどのようにサブコンポーネントを作成できるか知りたいです。 それは
class Row Extends MyFormComponent , Component {}
のような構文を使用するか、このアプローチのための他の方法ラウンドはありますか? @Borjanteはしかし、これは別のコンポーネントの下にグループコンポーネントにだけの方法で、約特別な「サブコンポーネント」動作がないことを、コメントとして
MyFormComponent.Row = class Row extends React.Component { ... }
:
サブコンポーネント?私の推測では、新しいReact Component(これはオブジェクトです)を作成して別のReact.Component(別のオブジェクト)のキーに格納するだけです。私はそれの美しさを見ることができません – Borjante
答えについてはここを参照することができますhttp://stackoverflow.com/questions/41576711/in-reactjs-how-do-i-create-subcomponent-using-extends/41577285#41577285 – anandharshan