Skip to content
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

not compatible with react-router Link #2243

Closed
jma7889 opened this issue Nov 23, 2015 · 13 comments
Closed

not compatible with react-router Link #2243

jma7889 opened this issue Nov 23, 2015 · 13 comments
Labels
bug 🐛 Something doesn't work

Comments

@jma7889
Copy link

jma7889 commented Nov 23, 2015

I tried to use Link with Menu Item and List Item. Both don't work. As Link is the main navigation for react-router, if it doesn't work, then how can I make -ui work with react-router?

None of the below worked

`<ListItem primaryText="All mail" >
      <Link to="/foo">foo</Link>
</ListItem>`

Then I wrap Link with ListItem, not working neither.
Try the same thing with MenuItem, both not working.

-- update 1
It is working now with following syntax. Case can be closed. I wish this is documented.
<MenuItem linkButton={true} containerElement={<Link to="/foo" />} primaryText="Foo" />

@frankf-cgn
Copy link

@jma7889 Quite interesting question, but for now I can't see a bug here. Can we discuss on discordapp (Reactiflux/#material-ui) or on gitter?

@jma7889
Copy link
Author

jma7889 commented Nov 23, 2015

@frankf-cgn did see some previous discussion regarding this. About to try if any of those works. Yes, we can discuss on discord app. It's not a bug, more of a feature request.

-- update 1
It is working now with following syntax
<MenuItem linkButton={true} containerElement={<Link to="/foo" />} primaryText="Foo" />

@frnk94
Copy link

frnk94 commented Nov 23, 2015

@jma7889 Otherwise you could just use Navigation mixin:

_handleLink: function(path) {
    this.transitionTo(path);
},
....
<ListItem primaryText="All mail"  onTouchTap={this._handleLink.bind(this, 'mail'}  />

@alitaheri alitaheri added the bug 🐛 Something doesn't work label Dec 9, 2015
@hourliert
Copy link

Thanks @jma7889. Would be nice if documented.

@oliviertassinari
Copy link
Member

Should be fixed by #2708.

@Dafrok
Copy link

Dafrok commented Mar 13, 2016

@jma7889 If the right-icon-button or some other buttons in a listitem this way, for example:

<ListItem
  rightIconButton={<IconButton />}
  primaryText='some text'
  containerElement={<Link to={{pathname:"/"}} />

These buttons didn't work well.

@dahuchao
Copy link

I think, you made a mistake :
try this

<ListItem
  rightIconButton={<IconButton />}
  primaryText='some text'
  containerElement={<Link to="/"/>} />

@Paelsis
Copy link

Paelsis commented Jun 21, 2017

containerElement with react-router Link works fine with MenuItem but not in ListItem.

@HZSamir
Copy link

HZSamir commented Jun 28, 2017

@Paelsis This. Wondering if it's going to be fixed.

@quasi-nova
Copy link

containerElement with react-router Link for TableRow would be helpful as well.

@MarcelRobitaille
Copy link

Are there any updates on this? Not even <MenuItem linkButton={true} containerElement={<Link to="/foo" />} primaryText="Foo" /> is working for me.

@iozeey
Copy link

iozeey commented Mar 7, 2018

@Iambecomeroot

This is how it worked for me.

 <MenuItem key={i} component={Link} to='/somelink' >
                      {option.primaryText}
</MenuItem>

Source
https://stackoverflow.com/a/47875510

@MarcelRobitaille
Copy link

@zeeshan-za-ahmad Working for me. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work
Projects
None yet
Development

No branches or pull requests