Skip to content

Instantly share code, notes, and snippets.

@jethroo
Forked from davidkpiano/app.js
Created February 15, 2017 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jethroo/42db2eba39ac2b3bab04016a76381e7a to your computer and use it in GitHub Desktop.
Save jethroo/42db2eba39ac2b3bab04016a76381e7a 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