steevehook
6/29/2018 - 3:15 PM

Simple way to namespace React components

Simple way to namespace React components

import React from 'react';

export class Foo extends React.Component {
  render() {
    return <div>foo</div>;
  }
}

export class Bar extends React.Component {
  render() {
    return <div>bar</div>;
  }
}
import React from 'react';

import * as My from './components/my-components.js';

export default class App extends React.Component {
  render() {
    return (
      <div>
        <My.Foo />
        <My.Bar />
      </div>
    );
  }
}