我有一个用于React Router Dom和Material UI的包装组件:
我该如何将
import Button from '@material-ui/core/Button';
import React from 'react';
import { Link as RouterLink } from 'react-router-dom';
const forwardedLink = React.forwardRef((props, ref) => (
<RouterLink innerRef={ref} {...props} />
));
function Link(props) {
return (
<Button component={forwardedLink} {...props}>
{props.children}
</Button>
);
}
Link.propTypes = // ?
export default Link;
我该如何将
Button
的Prop-Types赋给Link
?
Link.propTypes = Button.propTypes;
的翻译是:Link.propTypes = Button.propTypes;
。 - zerkmspropTypes
。 - J. Hesters