2 ms·
"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 answ
by 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.