Is there a way to use ngrx/store on Ionic 2?

I’m learning about ngrx/store and one gotcha to use it is related to performance.

The documentation say this:

“The concept behind OnPush is straightforward, when components rely solely on inputs, and those input references do not change, Angular can skip running change detection on that section of the component tree.”

(https://gist.github.com/btroncone/a6e4347326749f938510#taking-advantage-of-changedetectiononpush)

But how can I use inputs with pages or even between pages? You guys get my point here?

I see pages always on the same level and I don’t know if a can pass inputs from ion-app.

Thanks!

1 Like

You must set data in the app state with a reducer and then get with: this.store.select((state: AppState) => state.???) in the target page.

Where “???” is the property in the AppState.
No need to hard type the state variable, but I did because “autocompletionism”.