I am using react "react": "^17.0.0", function component to pass parameter like this:
interface RoleProps {
roles: IRoleState
dispatch: Dispatch
roleListLoading: boolean
}
const EditPermission: React.FC<RoleProps> = ({roles, dispatch, roleListLoading}) => {
}
but I still want to pass another parameter into the function component by using props like this:
<EditPermission
onSubmit={async (value) => {
if(!currentRow){
return
}
const success = await handleUpdate(value,currentRow.id);
if (success) {
handleUpdateModalVisible(false);
setCurrentRow(undefined);
if (actionRef.current) {
actionRef.current.reload();
}
}
}}
onCancel={() => {
handleUpdateModalVisible(false);
setCurrentRow(undefined);
}}
updateModalVisible={editPermissionModalVisible}
values={currentRow || {}}
/>
I have alredy define the props like this:
export type UpdateFormProps = {
onCancel: (flag?: boolean, formVals?: FormValueType) => void;
onSubmit: (values: FormValueType) => Promise<void>;
updateModalVisible: boolean;
values: Partial<API.InterviewListItem>;
};
what should I do to pass both parameter into the function component? is it possible to pass both parameter into component?
React.FC<RoleProps & UpdateFormProps>solve it?