Skip to content

Add routerLink HoC #3431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Add routerLink HoC #3431

wants to merge 1 commit into from

Conversation

yp
Copy link

@yp yp commented May 5, 2016

routerLink provides a convenient way to customize the appearance of <Link>s by essentially "injecting" some properties to the wrapped component such as linkActive and handleClick.

For example, with this component it is easy (and maintainable) to write components that applies classes if the link is not active or that should not be "fully clickable" (e.g., a <div> containing the actual link).

Furthermore, this component extracts most of the logic from <Link> which now becomes a presentation-only component wrapped by routerLink (hence more maintainable, hopefully).

routerLink provides a convenient way to customize the appearance of <Link>s by essentially "injecting" some properties to the wrapped component such as linkActive and handleClick.

For example, with this component it is easy (and maintainable) write components that applies classes if the link is not active or that should not be "fully clickable" (e.g., a <div> containing the actual link).

Furthermore, this component extracts most of the logic from <Link> which now becomes a presentation-only component wrapped by routerLink.
@taion
Copy link
Contributor

taion commented May 5, 2016

See discussion starting at #83 and more recently #3408. We intentionally only render <a> from <Link>. If you want an HoC, consider using React-Router-Bootstrap.

@taion taion closed this May 5, 2016
@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants