Often when building UI the Problem arises that User Input Components are located visually outside of components owning the state.
Suppose you are building a wizard of forms with multiple steps, which has to submit a respective form on clicking the next button:
class WizardContainer {
render(){
return
<Wizard>
<FormContainer/>
<NavigationContainer/>
</Wizard>
}
}
class NavigationContainer {
currentFromContainer(){ ... }
render(){
let FormContainer = currentFormContainer()
return <FormContainer/>
}
class WizardContainer {
render(){
return
<Navigation title="next", onClick={...}>
}
}
On submit a graphql mutation with the inputs from the current Form must be fired. Ideologically the submit code for the current Form belongs into the respective Formcontainer. But the action submit Action is outside.
What would be the best way to solve such a cross component communicatioin with apollo and apollo-link-state?
Or is this something outside of apollo scope? If so, what are some react idiomatic solutions?
Redux does not solve this problem either. One can put the state of the forms to the central store, but submission is always a different action.