Glide: Work with react-router's <Link> ?

Created on 23 May 2018  路  6Comments  路  Source: glidejs/glide

<Link> will be broken (like <a> reload page) after glidify.

Most helpful comment

@RoberMac is right, I also tried an it works that way. Should we submit a PR @jedrzejchalubek?

All 6 comments

I use modular import and mount without Anchors module, then it works. But Is there have a better way to do that?

I don't have much experience with React and you don't provide code examples, but give you some hints.

Not mounting a particular component is the best way if you don't want its functionalities. Anchors component is responsible for handling clicking and dragging events of the internal <a> HTML elements, so they won't interfere while interacting with a carousel. Without this component, they may be problems with mouse/touch swiping when dragging have stared on <a> elements.

The way it does it may be not compatible with an output of react's <Link> component. I would need an example that illustrating the problem to say something more.

Simply put, <Link> component actually is a <a> with attached event (like onclick), but Anchors module seems stopPropagation, so <Link>'s event handler may not be fired. I remove the line of stopPropagation then it works too.

@RoberMac is right, I also tried an it works that way. Should we submit a PR @jedrzejchalubek?

@apuntovanini Of course! Would be really glad :)

I spent 90 minutes debugging this exact issue. Thank you for fixing this!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LostCrew picture LostCrew  路  3Comments

mxmtsk picture mxmtsk  路  5Comments

ghost picture ghost  路  3Comments

adambartosiewicz picture adambartosiewicz  路  3Comments

heliomsolivas picture heliomsolivas  路  8Comments