Closed Parinyadahmi closed 5 years ago
Hi,
you can use reaction
or autorun
from MobX:
https://mobx.js.org/refguide/reaction.html
https://mobx.js.org/refguide/autorun.html
dear @adamkleingit I have tried to add a reaction to my store by
reaction(
() => this.accelerometer,
accelerometer => {
console.log('TTTTTTTTTTTTTTTTTTTTTT', accelerometer);
this.recalculateScannerData();
},
{ fireImmediately: true }
);
but it triggers only once. On future updates of accelerometer object it is not fired. Any idea why?
import {Component, OnChanges, OnInit, ChangeDetectionStrategy, ChangeDetectorRef} from '@angular/core'; import {UserStore} from '../stores/user.store';
@Component({ selector: 'app-portfolio', templateUrl: './portfolio.component.html', styleUrls: ['./portfolio.component.css'] }) export class PortfolioComponent implements OnInit, OnChanges {
}