faceyspacey / redux-first-router-link

<Link /> + <NavLink /> that mirror react-router's + a few additional props
MIT License
55 stars 33 forks source link

Unable to get raw href strings for use outside of <Link> component #115

Open DannyDelott opened 5 years ago

DannyDelott commented 5 years ago

We use a component library that provides lots of interactive components like Buttons, MenuItems, etc.. which take an href prop and create <a> elements in the DOM.

<Link> is great for when we just want simple links, but is there a recipe for getting raw href strings out of RFR so we can pass them to other kinds of components that provided linking functionality?

ScriptedAlchemy commented 5 years ago

Hmm you can just have a onclick to dispatch a redux action which navigates you where you want to go.

DannyDelott commented 5 years ago

The issue is users will expect to be able to right-click and open in a new tab/window, which requires href.

ScriptedAlchemy commented 5 years ago

If it’s mapped in routesMap, won’t it just open them to the right location?

DannyDelott commented 5 years ago

Not sure what you mean. Here's the user distinction I'm referring to:

With href, the browser (chrome) provides options for opening the link in a new tab. The onclick would just open the link in the current window every time.

href onclick
image image