Created
September 4, 2015 14:41
-
-
Save davidkpiano/c907be5a4768e7a066cc to your computer and use it in GitHub Desktop.
Simple way to namespace React components
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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