6 ms·
By the way, about that "dispatch an action containing the final results when the form is complete" — what is the Correct Way™ to do this, if there may be severa
by Joker_vD 5y ago
By the way, about that "dispatch an action containing the final results when the form is complete" — what is the Correct Way™ to do this, if there may be several instances of the form? They should produce different actions so that different pieces of state would be updated.
- acemarke 5y ago"It Depends"? :) Typically if you've got a single React component type that is supposed to be reused in multiple places with differing behavior, the right answer is "pass in something as a prop". In this case, that could be a callback function that dispatches the correct action, so the form component can just do `props.onFormCompleted(data)`, and the differing usage sites can pass in different callbacks that dispatch different actions.