-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Add LinkContainer.js #7546
Add LinkContainer.js #7546
Conversation
also what value is |
I think |
} | ||
} | ||
|
||
GatsbyLinkContainer.propTypes = propTypes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
propTypes here have required location
which is not not there at exported component level - it get's added by <Location>
in code below
fc4ca3e
to
2116fff
Compare
unfortunately no. This is about controlling what component Link renders as an anchor, not getting access to the ref |
Note: I don't necessarily know how to document this, but happy to make that change too. This is in regards to gatsbyjs/gatsby#7546, where a custom element needs to be passed (e.g. a bootstrap link) and this provides that functionality. The API is similar to something like styled-components, and this change is a non-breaking, backwards compatible API. Let me know if you have any questions!
@jquense I think we can improve this behavior upstream, rather than introducing this workaround in our own code. I've opened a PR for reach-router (reach/router#226) to accept an Since we forward all props directly to the I'm not super familiar with react-bootstrap, so if you have an example that would be 👌 . |
@jquense I'm going to close this--we should defer to that upstream behavior PR modification (reach/router#226) that will hopefully get merged soon. I think that's a little cleaner and it's nice to get the benefit for free rather than making changes here. As always--thanks for the PR. Sorry for the delay on this one! |
I’m not quite sure this the right setup, but I think Gatsby really needs to prove a way to create links without needing to always render a DOM
<anchor>
. BEFORE anyone jumps in to say that that is not accessible, that’s silly. There isn’t any way without this to render navigation links from UI components, components that do render an anchor but also have other logic on top of it. Like react-bootstraps NavLink component. A presentational wrapper around an<a>