質問
LinkPropsはpropsの型だと思うのですがOmit<RouterLinkProps, 'to'>を指定する意味がわかりません。教えてください。お願いします。
js
1import { Link as RouterLink, LinkProps as RouterLinkProps } from 'react-router-dom'; 2import { LinkProps } from '@mui/material/Link'; 3 4const LinkBehavior = React.forwardRef< 5 HTMLAnchorElement, 6 Omit<RouterLinkProps, 'to'> & { href: RouterLinkProps['to'] } 7>((props, ref) => { 8 const { href, ...other } = props; 9 // Map href (MUI) -> to (react-router) 10 return <RouterLink ref={ref} to={href} {...other} />; 11});

回答1件
あなたの回答
tips
プレビュー
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。
また依頼した内容が修正された場合は、修正依頼を取り消すようにしましょう。
2022/08/29 06:47
2022/08/29 06:52
2022/08/29 06:56
2022/08/30 03:17
2022/08/30 03:44
2022/08/30 09:59
2022/08/30 10:59
2022/08/30 21:43
2022/09/09 08:45
2022/09/09 10:52
2022/09/09 10:58