'Next/Link refreshes page on shallow routing

I have a Link:

<Link href={href} passHref shallow>
      <StyledLink
        $active={active}
        $disabled={disabled}
        onClick={() => passBackNumber(number)}
      >
        {number}
      </StyledLink>
</Link>

where StyledLink is my styled.a element and onClick passes number that was just clicked. I found information that if you want to use <Link/> + styled-components you need to use passHref. But issue is even though I specified shallow, page still is getting refreshed. I only want to url to change and trigger callback. What did I do wrong?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source