Skip to content

Instantly share code, notes, and snippets.

@davidkpiano
Created September 4, 2015 14:41
Show Gist options
  • Save davidkpiano/c907be5a4768e7a066cc to your computer and use it in GitHub Desktop.
Save davidkpiano/c907be5a4768e7a066cc to your computer and use it in GitHub Desktop.
Simple way to namespace React components
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>
);
}
}
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>;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment