Thanks to visit codestin.com
Credit goes to github.com

Skip to content

TypeError: "class constructors must be invoked with 'new'" #54

@kud

Description

@kud

Hello,

I'm doing this:

import React from "react"
import { Model } from 'coloquent'

class AppModel extends Model {
  getJsonApiBaseUrl() {
    return 'http://mysite.com/api'
  }
}

class Bill extends AppModel {
  jsonApiType = 'bills'
}


class SandboxPageMainPage extends React.Component {
  static propTypes = {}

  static defaultProps = {}

  state = {}

  componentDidMount() {
    const billModel = new Bill()

    billModel.get()
  }

  render() {
    return (
      <div>Coloquent test!</div>
    )
  }
}

export default SandboxPageMainPage

And I get this error:

TypeError: "class constructors must be invoked with 'new'"

Is it normal?

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