Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React native + Mobx, @inject decorator throws an error

I'm trying to use mobx with react native and stuck into a problem.

@inject('someStore')
@observer
export class SomeComponent extends Component {
   render() {
       ...
   }
}

I'm sure I configured properly babel plugins for decorator but @inject decorator gives me an exception "Expected a constructor.".

enter image description here

I have no idea why this happen since I had used mobx in this way in an other project. Does anyone had been through this issue?

like image 944
jesuisgenial Avatar asked Jun 07 '19 06:06

jesuisgenial


1 Answers

I downgraded the mobx-react version to 5.4.4 and I can confirm that it works.

Try to downgrade mobx-react.

yarn add [email protected]
like image 104
bkm412 Avatar answered Sep 20 '22 00:09

bkm412