Repository: strapi/strapi
File: packages/core/admin/admin/src/components/LeftMenu.tsx (TypeScript)

Code before:
  const listLinksAlphabeticallySorted = [...pluginsSectionLinks, ...generalSectionLinks].sort(
    (a, b) => formatter.compare(formatMessage(a.intlLabel), formatMessage(b.intlLabel))
  );
  const listLinks = sortLinks(listLinksAlphabeticallySorted);

  return (
    <MainNav>
      <NavBrand />

      <Divider />

      <NavListWrapper tag="ul" gap={3} direction="column" flex={1} paddingTop={3} paddingBottom={3}>
        {listLinks.length > 0
          ? listLinks.map((link) => {
              const LinkIcon = link.icon;
              const badgeContentLock = link?.licenseOnly ? (
                <Lightning fill="primary600" />
              ) : undefined;

              const badgeContentNumeric =
                link.notificationsCount && link.notificationsCount > 0
                  ? link.notificationsCount.toString()
                  : undefined;

              const labelValue = formatMessage(link.intlLabel);
              const GuidedTourTooltip = getGuidedTourTooltip(link.to);
              return (
                <Flex tag="li" key={link.to}>
                  <GuidedTourTooltip>
                    <NavLink.Tooltip label={labelValue}>
                      <NavLink.Link
                        to={link.to}
                        onClick={() => handleClickOnLink(link.to)}
                        aria-label={labelValue}
                      >
                        <NavLink.Icon label={labelValue}>
                          <LinkIcon width="20" height="20" fill="neutral500" />
                        </NavLink.Icon>
                        {badgeContentLock ? (
                          <NavLinkBadgeLock
                            label="locked"
                            textColor="neutral500"
                            paddingLeft={0}
                            paddingRight={0}
                          >
                            {badgeContentLock}
                          </NavLinkBadgeLock>
                        ) : badgeContentNumeric ? (
                          <NavLinkBadgeCounter
                            label={badgeContentNumeric}
                            backgroundColor="primary600"

Review comment (suggestion):
I believe this creates a brand new component on every render, which should be avoided. See the react docs on the topic: https://react.dev/learn/your-first-component#nesting-and-organizing-components

Code after:
  const initials = getInitials(user);

  const handleClickOnLink = (destination: string) => {
    trackUsage('willNavigate', { from: pathname, to: destination });
  };

  const listLinksAlphabeticallySorted = [...pluginsSectionLinks, ...generalSectionLinks].sort(
    (a, b) => formatter.compare(formatMessage(a.intlLabel), formatMessage(b.intlLabel))
  );
  const listLinks = sortLinks(listLinksAlphabeticallySorted);

  return (
    <MainNav>
      <NavBrand />

      <Divider />

      <NavListWrapper tag="ul" gap={3} direction="column" flex={1} paddingTop={3} paddingBottom={3}>
        {listLinks.length > 0
          ? listLinks.map((link) => {
              const LinkIcon = link.icon;
              const badgeContentLock = link?.licenseOnly ? (
                <Lightning fill="primary600" />
              ) : undefined;

              const badgeContentNumeric =
                link.notificationsCount && link.notificationsCount > 0
                  ? link.notificationsCount.toString()
                  : undefined;

              const labelValue = formatMessage(link.intlLabel);
              return (
                <Flex tag="li" key={link.to}>
                  <GuidedTourTooltip to={link.to}>
                    <NavLink.Tooltip label={labelValue}>
                      <NavLink.Link
                        to={link.to}
                        onClick={() => handleClickOnLink(link.to)}
                        aria-label={labelValue}
                      >
                        <NavLink.Icon label={labelValue}>
                          <LinkIcon width="20" height="20" fill="neutral500" />
                        </NavLink.Icon>
                        {badgeContentLock ? (
                          <NavLinkBadgeLock
                            label="locked"
                            textColor="neutral500"
                            paddingLeft={0}
                            paddingRight={0}
                          >
                            {badgeContentLock}