We're working in Angular 4 project with RXJS and Redux for state management. Currently we're working on a Wizard feature. The wizard include 5 steps that every step is a reactive form by himself, and every step has sub reducer for handling his own state.
WizrdReducer:
{
error: <handled by HOR>
pending: <handled by HOR>
warning: <handled by HOR>
settings: <handled by sub-reducer>
step1Subreducer: <handled by sub-reducer>
step2Subreducer: <handled by sub-reducer>
step3Subreducer: <handled by sub-reducer>
step4Subreducer: <handled by sub-reducer>
step5Subreducer: <handled by sub-reducer>
}
Every step dispatch an action that save the form value in the state. The wizard component perform the save operation in the last step, the save operation should collect all the values from the state(all sub reducers) and perform the REST operation for creating the Object. We read a lot of articles about the getstate() function and that we shouldn't use it for getting the state(Anti pattern, do you also think so?). Our current solution is to subscribe to every sub reducer in the state(step1SubReducer, Step2SubReducer) and assign these values to variables inside the wizard component, but it's looks like a workaround and will cause to many subscription to trigger events even if we only need it in our final step. Any suggestions?
Thanks!