export const GroupedInputWithLabel = (props) => {
const { required, children, fieldName } = props;
const inputComponent = (
<>
<ControlLabel htmlFor={fieldName} required={required} />
{children}
</>
);
return <GroupedInput {...props}>{inputComponent}</GroupedInput>;
};
export const withGroupInput = (props, Component) => (
<GroupedInputWithLabel {...props}>
<Component {...props} />
</GroupedInputWithLabel>
);
老师我有这么一段逻辑 withGroupInput
是用HOC形式完成的 想问下这种不涉及state的逻辑封装有必要用custom hook做吗?如果有 请问如何改成custom hook? 谢谢