Views

You can automatically create new React components by using the make:view command.

Command

kitty make:view MyNamespace MyViewName

Output

/**
 * MyNamespace MyViewName
 */
MyNamespace = typeof MyNamespace === 'undefined' ? {} : MyNamespace;

MyNamespace.MyViewName = React.createClass({
  mixins: [ReactMeteorData, ReactBEM],
  getMeteorData() {
    return {};
  },
  getInitialState() {
    return {};
  },
  getDefaultProps() {
    return {};
  },
  componentDidMount() {
    //
  },
  bem_blocks: ['my-view-name'],
  bem_block_modifiers: ['my-namespace'],
  bem_render() {
    return (
      <div bem_element="">
        <p>Hello</p>
      </div>
    );
  }
});

Components are organized and namespaced via folders. In the above example, the code would be located in {app}/client/components/MyNamespace/MyViewName/MyViewName.jsx.

Views in Space Kitty use auto-generated BEM classes also come with a SCSS file. This allows you to style you components without ever having to write a class name! For more information on React BEM, see our documentation on our capsulecat:react-bem package.

 

Previous: Creating a Project

Next: Making Collections