I have parent-child states:
@State({
name: 'parent',
default: { parentProp : 'foo' },
children: [
ChildState,
]
}) class ParentState {}
and
@State({
name: 'child',
default: { childProp: 'bar' },
}) class ChildState {}
then in an action in the parent state, I'd like to get the state from the child.
Is there a way how can I do it in an action handler, at this point I don't see how to do it, because action handler has the only StateContext
and action payload?
Seems I could do something like
const child = <ChildStateModel>this.store.selectSnapshot(state => state.child);
or just use
@Action(context: StateContext<ChildStateModel>, action: any)
if need to access only to the child