Skip to content

Explicit contextTypes required? #2

@leebenson

Description

@leebenson

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions