Inferno: Upgrade to v4: TypeError: (0 , _infernoMobx.connect) is not a function

Created on 17 Feb 2018  路  2Comments  路  Source: infernojs/inferno

Hello. After migrating to v4 I got TypeError: (0 , _infernoMobx.connect) is not a function

image

image

image

image

How to resolve it?

Thx.

Most helpful comment

maybe you need to disable module transformation? Can you debug the code without sourcemaps to see what is (0 , _infernoMobx. object in this case.

Edit: connect has been removed as its been deprecated in react-mobx/inferno-mobx

I Believe this is correct syntax from v4 forward:

@inject('itemsStore') @observer
class ChildComponent extends React.Component {
  render() {
    return (
      <div className="index">
        {this.props.itemsStore.items.map((item, index) => {
          return <span key={index}>item.name</span>
        })}
      </div>
    );
  }
}

See React documentation here:
https://mobx.js.org/intro/overview.html

same patterns apply to Inferno

All 2 comments

maybe you need to disable module transformation? Can you debug the code without sourcemaps to see what is (0 , _infernoMobx. object in this case.

Edit: connect has been removed as its been deprecated in react-mobx/inferno-mobx

I Believe this is correct syntax from v4 forward:

@inject('itemsStore') @observer
class ChildComponent extends React.Component {
  render() {
    return (
      <div className="index">
        {this.props.itemsStore.items.map((item, index) => {
          return <span key={index}>item.name</span>
        })}
      </div>
    );
  }
}

See React documentation here:
https://mobx.js.org/intro/overview.html

same patterns apply to Inferno

Thanks. This helped me!

Was this page helpful?
0 / 5 - 0 ratings