React ES6 Namespaces


#1

I’m trying to update some old React code. How are you guys handling namespaces in ES6?
My old code looks like this:
Project.Create = React.createClass({
I tried this:
export default class Project.Create extends React.Component{
but it fails in multiple ways.


#2

You have to give your class a name. Now the name is Project.Create, that doesn’t work. After you’ve given it a name, you can import it in other files by referencing the filename.


#3
export default class Create extends React.Component {}

Project.Create = Create;

#4

Thanks, I guess namespaces are not really necessary because you can rename conflicts on import:
import {Create as ProjectCreate} from "../projects/Create";
or for the default export:
import ProjectCreate from "../projects/Create";