-
-
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
Extracted LinkMixin from Link #168
Conversation
[changed] Link uses LinkMixin (same api)
I'm open to writing more tests for this, but I wanted to get feedback before going too much further. |
I don't understand why this is necessary. Why can't you just render a |
My goal here is to use the react-bootstap library to handle the orchestration of all our bootstrap classes onto DOM elements. They already have a |
Note that the react-bootstrap guys are already applying classes in a nice way: https://github.com/react-bootstrap/react-bootstrap/blob/master/src/NavItem.jsx And you guys are doing awesome stuff with Link that makes the Now, I'd like to bring the two together as seamless as possible. When you guys make changes to how Link works I want my stuff to pick up that change. When the react-bootstrap guys make changes to their stuff I'd like to get those changes. Hence my reasoning that extracting the non-view specific logic around link handling to a mixin will allow a simple and concise wrapper component that ties the two concepts together. My goal with my react-router-bootstrap package is to build up wrappers for each of the react-bootstrap components that do link type stuff. Could this mixin reside in my repo, sure. But I would still have to copy any of your changes you may or may not make over time, as I've already done. |
Hit the wrong button |
I found a second use case for this, as I'm sure more will follow. When using the react-bootstrap |
|
All that does is put a simple class on the anchor, but what if that button is nested within a Nav? I agree that does get a class on there, but then you are loosing all the nice work done by react-bootstrap. I feel like you are not even looking at the react-bootstrap source, or even considering how to make this interact well with other libraries. I'd like something like If you look at the react-router-bootstrap I have added this |
Just to help me understand, you could also be asking the react-bootstrap devs to make I admit I am hesitant, when people start using it on |
Seems to me that whenever react-bootstrap renders an anchor tag, they ought to have built their API in a way to allow you drop in I don't mean to frustrate you, I just need some more convincing :\ |
https://github.com/react-bootstrap/react-bootstrap/blob/master/src/Button.jsx#L46 Can't you do |
Hey @rpflorence, the solution you suggested above is what was originally proposed, have a read of this comment i posted in response and see if you agree with its points: react-bootstrap/react-bootstrap#187 (comment) |
Again, to maybe help you understand why we're hesitant. When we change things in Public API that brings flexibility brings with it liability. |
The mixin has a lot of code specifically for handling a click on an anchor tag. If you use the mixin on a button element you will get undesirable behavior when the event Then we'll get requests to not prevent the actions if its a button v. an anchor. Then somebody will want to use it on an I hope this makes sense and I'm not giving you the grumps. I also hope you understand the liability this kind of mixin brings. So ... I would like to:
|
I think the problem is that by proposing the I think that asking for react-bootstrap to expose more extensibility is a much more difficult undertaking, and it would make its codebase far more complex than it needs to be. I know that the Button component has that In the vain of talking about this, it makes me wonder if I should remove the I can see how the |
Exactly. They are not. We provide one view component for the majority use-case of moving around an app, and then
I don't want a mixin that requires so much implementation hand-holding. note: I hope you saw the message two above this one. |
Then how do you feel about a mixin that just does the prop extraction? Not, the handle click and active state. |
Agree with @rpflorence on this. I'd rather expose the router-specific bits of functionality than start concerning ourselves with UI components (and/or mixins for them). |
This seems like a good solution, i still think there is value in a |
Yeah, as soon as we ship a |
I updated my integration library to have two mixins one is a |
promoting this to public API so others can use it to build components like `<Link/>` closes remix-run#168
The goal here is to be able to allow for a react-bootstrap
NavItem
to utilize the power ofLink
. Virtually removing all the duplicated code in react-router-bootstrap in particular for theNavItemLink
component.