Skip to content

Conversation

@afzalsayed96
Copy link
Contributor

@afzalsayed96 afzalsayed96 commented Mar 10, 2023

👋

I've run into a use-case where I need the isActive logic of react-router NavLink but do not want to render a Link itself. Exporting a useNavLink hook solves this. Wondering if the maintainers would be interested in adding this as a feature in the library iteself.

@changeset-bot
Copy link

changeset-bot bot commented Mar 10, 2023

🦋 Changeset detected

Latest commit: 3f2e8eb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
react-router Patch
react-router-dom Patch
react-router-dom-v5-compat Patch
react-router-native Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@brophdawg11
Copy link
Contributor

Thanks for the feature proposal! We've recently moved to an Open Development Process so would you mind putting this feature request into a new Proposal in the Discussions tab? Thank you!

@tpict
Copy link

tpict commented Mar 17, 2023

@afzalsayed96 I just ran into the same issue. We have a directory structure in our app where each "file" is a Link, and we want to open all of the Link's parent directories on page load if their routes match. This was trivial in v5 with useMatch. There's enough logic in NavLink now that I'm not really comfortable copy-pasting it into our source, because I would have no idea how to fix it the next time react-router API changes are shipped.

We probably want a more generic name than useNavLink because this definitely has broader applications. Might need help from the Remix team in coming up with something that's consistent with their terminology.

Would you like to open a proposal? I can open one if you'd like. Thanks!

@afzalsayed96
Copy link
Contributor Author

afzalsayed96 commented Mar 17, 2023 via email

@willhoney7
Copy link

link to the discussion proposal: #10224

@nicksrandall
Copy link

@brophdawg11 Any chance you could re-open this PR? An open discussion has been available for a few months with no comments from Remix/RR team. IMHO, this feature seems like a no-brainer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants