Main pattern in react (and even more important in rect-redux) is that user actions do not result directly in actions that change user interface. User actions result in actions that change state. Once the state is changed all components that use that part of state get rerendered, and they only have to take care to correctly render reflecting the state.
How this applies to this part of your question: "Also, after handleSubmit, where should I have the code that updates the view to show the user a success UI - example: Success! Your invites hav been sent." ?
The answer is you do not need part of code that updates view to display "Success" message. You need part of code that will modify part of the state (in redux action creators and reducers) that reflects successful invitation like state.invitationSuccess: true
.
Your components will then be responsible to display success message if this part of the state is true.
As for who should be handling submission, both approaches could be used, one where form component handles the submission (probably by dispatching action), is simpler. One where container handles the submission could be more flexible in cases where you would use same form to edit more than one entity.
InviteForm
purely invitation and get actions and state from props throughconnect
but I'm not sure withredux-form
. It seems like this is consistent though, have the submit handler be an action that updates state and map thrumapDispatchToProps
, then in the component check if that state is updated and show maybe a banner indicating the invite was sent? - Andrew Li