Skip to content

Instantly share code, notes, and snippets.

@steevehook
Forked from davidkpiano/app.js
Created June 29, 2018 15:15
Show Gist options
  • Save steevehook/02bece7638d0480f921b38001cbd12dd to your computer and use it in GitHub Desktop.
Save steevehook/02bece7638d0480f921b38001cbd12dd 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