0

I need to use this method to create form elements component set, But still I don't have an idea of how to do this with ES6. So could anyone can tell me how to do this with ES6?

var MyFormComponent = React.createClass({ ... });

MyFormComponent.Row = React.createClass({ ... });
MyFormComponent.Label = React.createClass({ ... });
MyFormComponent.Input = React.createClass({ ... });

Usage:

var Form = MyFormComponent;

var App = (
  <Form>
    <Form.Row>
      <Form.Label />
      <Form.Input />
    </Form.Row>
  </Form>
);
TIJ
  • 2,771
  • 3
  • 19
  • 32
  • 3
    You mean es3 namespaces? With creating `my.global.something`? With es6 you should separate your code to modules and then use [`import`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import) – Lesha Ogonkov Sep 16 '15 at 18:53
  • useful link is [here](http://stackoverflow.com/questions/22499678/js-react-and-global-namespace-pollution) – The Reason Sep 16 '15 at 18:55

0 Answers0