The provided Link component has expected behavior. I will provide this solution as a PR. (Note: Difference tu current implementations is that the home route "/" will only be active when the current path is "/".)
Expected behavior
I expect on route "/foobar" the A with "/foo" not to be active as this is not a subpath of "foo" but just another route the has the same letters at the beginning of the route.
Describe the bug
"/foo" should not match if current route is "/foobar", but should match for "/foo" or "/foo/...".
Your Example Website or App
https://stackblitz.com/edit/github-a9ukgq-agqnyl?file=src%2Fapp.tsx
Steps to Reproduce the Bug or Issue
Expected behavior
I expect on route "/foobar" the A with "/foo" not to be active as this is not a subpath of "foo" but just another route the has the same letters at the beginning of the route.
Screenshots or Videos
Platform
Additional context
No response