auth0-blog / react-flux-jwt-authentication-sample

Sample for implementing Authentication with a React Flux app and JWTs
589 stars 102 forks source link

Composed component child context types #17

Closed ayozebarrera closed 9 years ago

ayozebarrera commented 9 years ago

Hi, very good job!

I'm having a problem with authenticated component (composed component) like this:

// ... imports
// We’re wrapping the home with the AuthenticatedComponent
export default AuthenticatedComponent(class Home extends React.Component {
  render() {
     // Here, we display the user information
    return (<h1>Hello {this.props.user.username}</h1>);
  }
});

I need to declare the child context type for the Home component (i'm using material-ui and I need the context for the appearance) but with ES6 + Composed components like yours, I can't do it!

If I use

Home.childContextTypes = {
  muiTheme: React.PropTypes.object
}

Home won't be found... (I know why).

So.. do you know the way to do that? Thankyou!

ayozebarrera commented 9 years ago

Solved, was easy.

Little experiencie with export/import modules :p.