Skip to content

Commit 8f5bf19

Browse files
Changed useMemo() to useCallback()
`useCallback(fn, deps)` is equivalent to `useMemo(() => fn, deps)` but more readable. Signed-off-by: adriancuadrado <adriancuadradochavarria97@gmail.com>
1 parent deb7a6d commit 8f5bf19

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

docs/data/material/guides/composition/composition.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,12 @@ import { Link, LinkProps } from 'react-router-dom';
8989
function ListItemLink(props) {
9090
const { icon, primary, to } = props;
9191

92-
const CustomLink = React.useMemo(
93-
() =>
94-
React.forwardRef<HTMLAnchorElement, Omit<RouterLinkProps, 'to'>>(
95-
function Link(linkProps, ref) {
96-
return <Link ref={ref} to={to} {...linkProps} />;
97-
},
98-
),
92+
const CustomLink = React.useCallback(
93+
React.forwardRef<HTMLAnchorElement, Omit<RouterLinkProps, 'to'>>(
94+
function Link(linkProps, ref) {
95+
return <Link ref={ref} to={to} {...linkProps} />;
96+
},
97+
),
9998
[to],
10099
);
101100

0 commit comments

Comments
 (0)