[docs] Fix React.forwardRef missing display name ESLint error
See original GitHub issue- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
In the ListItemLink sample code in the Material-UI documentation
function ListItemLink(props: ListItemLinkProps) {
const { icon, primary, to } = props;
const renderLink = React.useMemo(
() =>
React.forwardRef<any, Omit<RouterLinkProps, 'to'>>((itemProps, ref) => (
<RouterLink to={to} ref={ref} {...itemProps} />
)),
[to],
);
return (
<li>
<ListItem button component={renderLink}>
{icon ? <ListItemIcon>{icon}</ListItemIcon> : null}
<ListItemText primary={primary} />
</ListItem>
</li>
);
}
there is an ESLint error on React.forwardRef which prevents successful Typescript compilation, and therefore deployment of our site.
(ESLint) react/display-name: Component definition is missing a display name
React.forwardRef<any, Omit<RouterLinkProps, 'to'>>((itemProps, ref) => (
<RouterLink to={to} ref={ref} {...itemProps} />
)),
Expected Behavior 🤔
No Typescript compilation error.
Context 🔦
Just replicate the demo in the documentation.
Your Environment 🌎
System: OS: Windows 10 10.0.19042 Binaries: Node: 14.16.0 - C:\Program Files\nodejs\node.EXE Yarn: Not Found npm: 6.14.9 - C:\Program Files\nodejs\npm.CMD Browsers: Chrome: 90.0.4430.85 Edge: Spartan (44.19041.906.0), Chromium (90.0.818.46) npmPackages: @material-ui/core: 4.11.3 => 4.11.3 @material-ui/data-grid: 4.0.0-alpha.24 => 4.0.0-alpha.24 @material-ui/icons: 4.11.2 => 4.11.2 @material-ui/lab: 4.0.0-alpha.57 => 4.0.0-alpha.57 @material-ui/pickers: 3.3.10 => 3.3.10 @material-ui/styles: 4.11.3 => 4.11.3 @material-ui/system: 4.11.3 @material-ui/types: 5.1.0 @material-ui/utils: 4.11.2 @types/react: 17.0.3 => 17.0.3 react: 17.0.2 => 17.0.2 react-dom: 17.0.2 => 17.0.2 typescript: 4.2.4 => 4.2.4
Chrome Version 90.0.4430.85 (Official Build) (64-bit)
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
Thanks for the report.
Should be fixed with
Fix needs to be applied to https://github.com/eps1lon/material-ui/blob/next/docs/src/pages/guides/composition/composition.md as well.
@arpitBhalla Feel free too, yes