Cannot dispatch in the middle of a dispatch when firing action in child component
<p>I currently have my application structured so that I have a FormWrapper component which loads the configuration for the passed in FormName, which might be rendered by React-Router like this -</p>

<pre><code>&lt;Route path="/Diary/Test" components={require('./components/wrapperComponents/formWrapper.jsx')} FormName="AppointmentBooking"/&gt;
</code></pre>

<p>When FormWrapper loads it calls an ActionCreator and gets the configuration from the server about which page and renders the page passing in the configuration via objProps.</p>

<pre><code>render: function() {
    return(React.createElement(PageComponents[this.props.FormName], objProps);
}
</code></pre>

<p>The reason for doing things this way is that originally we wanted to be able to allow users to easily be able to customize how forms looked and which components were shown so it allowed us to store the forms and their accompanying child components in configuration and then just load them out with a generic wrapper component. So anything generic to every form could sit in the form wrapper, and then form specific code could sit in each page component and load only the parts relevent to that particular page.</p>

<p>The issue I'm having is that if the AppointmentBooking form also needs to fire an action in the componentWillMount/componentDidMount methods to load some data(for example the options in a dropdown list for appointment locations) I receive a "Cannot dispatch in the middle of a dispatch" error. </p>

<p>My reasoning for the issue was that the initial action triggered by the form wrapper was causing a re-render of the formWrapper because it then had data, and then React.createElement was trying to render the AppointmentBooking component which was also triggering an action thereby causing the dispatcher error.</p>

<p>I've read things about using waitFor() to wait for the first action to complete before triggering the second, but this would then involve the child component knowing about and being dependant  on it's parent which I thought might mean I'm not keeping a proper separation of concerns.</p>

<p>Is this a common issue and am I approaching this the right way? And if not is there a suggested way of going about acheiving this?</p>