Skip to content

Instantly share code, notes, and snippets.

@antekai
Forked from davidkpiano/app.js
Created February 25, 2019 23:05
Show Gist options
  • Save antekai/f21f4e64bb6bbcbce70cd2a8c3747fb7 to your computer and use it in GitHub Desktop.
Save antekai/f21f4e64bb6bbcbce70cd2a8c3747fb7 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