Skip to content

loadProps won't be called in class unless class is prefixed with "export default" #70

@OllieJennings

Description

@OllieJennings

I could be wrong here, but from testing, there appears to be a bug in how the static method loadProps is called.

For example, the method won't be called (shown in code below):

export default ({ children }) => (
   children || <DefaultPage />
);


class DefaultPage extends Component {
  constructor(props) {
    super(props);
  }

  static loadProps(stuff, cb) {
    console.log('async props called');
    cb(null, {});
  }

  render() {
    return (
      <div className="pw__wrapper">
      </div>
    );
  }
}

But in the example below, the method will be called

export default class DefaultPage extends Component {
  constructor(props) {
    super(props);
  }

  static loadProps(stuff, cb) {
    console.log('async props called');
    cb(null, {});
  }

  render() {
    return (
      <div className="pw__wrapper">
      </div>
    );
  }
}

Not sure if this intended or not?

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