frontarm / navi

🧭 Declarative, asynchronous routing for React.
https://frontarm.com/navi/
MIT License
2.07k stars 71 forks source link

Prefetch on hover #157

Closed nhooyr closed 4 years ago

nhooyr commented 4 years ago

I'm using onMouseHover on my Links to prefetch components. It'd be nice if Link could support this natively with a boolean option.

navi could also cancel the request if the user has moved their mouse away.

nhooyr commented 4 years ago

At the very least we need to add a field for onMouseHover in LinkProps.

nhooyr commented 4 years ago

Should just accept all HTML element props.

jamesknelson commented 4 years ago

Should just accept all HTML element props.

I agree. Will see what I can do.

nhooyr commented 4 years ago

Thank you @jamesknelson <3

kirelagin commented 4 years ago

For anyone searching around why their target="_blank" or target="_parent" don’t work, these commits fixed that too.

kirelagin commented 4 years ago

@jamesknelson You might also be interested in how react-router does this: since recently they added a check for target="_self": https://github.com/ReactTraining/react-router/blob/f31bb27aa61dd4cb1c3cd9aa78133f739e2e9bb9/packages/react-router-dom/modules/Link.js#L43