Skip to content

"Cannot call class as function" when extending @subscribe'd class? #35

@benallfree

Description

@benallfree

I'm getting an unexpected error when inheriting from a @subscribe'd class, can anyone tell me if I'm doing this right?

https://codesandbox.io/s/9ynn07091o

import React, { Component } from "react";
import ReactDOM from "react-dom";
import { Provider, subscribe } from "react-contextual";

const props = {
  test: "hello"
};

@subscribe()
class A extends Component {
  render() {
    const { test } = this.props;
    return test;
  }
}

class B extends A {}

ReactDOM.render(
  <Provider {...props}>
    <B />
  </Provider>,
  document.getElementById("root")
);
TypeError
Cannot call a class as a function

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions