But these props can be enhanced. For example, the from prop is used only when a specific user is about to be added. And, depending on that, a different 'add' function is used (addActiveUser, addStageUser, or addPreservedUser).
if (props.from === "active-users") {
dispatch(addActiveUser(userData));
} else if (props.from === "stage-users") {
dispatch(addStageUser(userData));
} else if (props.from === "preserved-users") {
dispatch(addPreservedUser(userData));
}
RFE: Instead of passing the from string to determine which 'add' operation to take, it would be better to pass the 'add' function directly to the AddUser component.
The
AddUser
component receives the following props:But these props can be enhanced. For example, the
from
prop is used only when a specific user is about to be added. And, depending on that, a different 'add' function is used (addActiveUser
,addStageUser
, oraddPreservedUser
).RFE: Instead of passing the
from
string to determine which 'add' operation to take, it would be better to pass the 'add' function directly to theAddUser
component.