Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit contextTypes required? #2

Open
leebenson opened this issue Jan 20, 2016 · 4 comments
Open

Explicit contextTypes required? #2

leebenson opened this issue Jan 20, 2016 · 4 comments

Comments

@leebenson
Copy link

Unless contextTypes is set manually on the target component, the flux prop is missing and no context is sent to listenTo() or getProps.

As a workaround, I currently have this middleware:

import React from 'react';
import { connect } from 'alt-react';

module.exports = function (Ele, opt) {
  Ele.contextTypes = {
    flux: React.PropTypes.object
  };
  return connect(Ele, opt);
};

It would be good if connect automatically added contextTypes to the target element if it doesn't already exist, or extends it with flux if it does.

@goatslacker
Copy link
Member

Sure this sounds reasonable to me.

@leebenson
Copy link
Author

@goatslacker - cool man. PS Love the ninja suit!

@goatslacker
Copy link
Member

What suit? It's a uniform.

@leebenson
Copy link
Author

you know what, I realised my faux pas as soon as I hit send. Of course it's a uniform. My bad!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants