I used the framework7 cli template for a f7-react cordova app. I tried to use it with mobx and mobx-react but it just doesn’t seem to work.
Problem: Changes in observed component classes and there observables do not trigger the react update lifecycle.
Does anybody have an idea what I am missing here? The counter does not update on the page.
import React, { Component } from 'react';
import {
Page,
Block
} from 'framework7-react';
import { observable, action } from "mobx"
import { observer } from "mobx-react"
@observer
export default class Home extends Component {
@observable counter = 1;
constructor(props) {
super(props);
this.increment = this.increment.bind(this);
}
componentDidMount() {
setInterval(this.increment, 1000);
}
@action
increment() {
this.counter += 10;
}
render() {
return (
<Page name="home">
<Block strong noHairlines>
<div>This is the current counter: {this.counter}</div>
</Block>
</Page>
)
}
}