question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: List.LinkItem should extends Link (preact-router)

See original GitHub issue

When navigating using

<a href="/somePath">Link</a>
<List.LinkItem href="/somePath">Link</List.LinkItem>

The whole app is rendered again.

When navigating using

<Link href="/somePath">Link</Link>
<List.Item onClick={() => route('/somePath')}>Link</List.Item>

Routing works as expected for a SPA

Would it be possible to either extends the Link component from preact-router or provide the same behavior when navigating, as well as the activeClassName for List.LinkItem as well as the other link components if there are others ?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
filoozomcommented, Jul 24, 2017

Should this really be included in this repo though? Preact can also be used with other routers, and this package doesn’t depend on preact-router, so I think it might be better to just use onClick or extend the component yourself?

0reactions
prateekbhcommented, Jul 25, 2017

I kinda agree with @filoozom because more prople use react-router than preact-router.

The problem with the onClick technique is that’s it’s not good for SEO and it adds a listener where a simple href attribute solve both problem.

The best part with this is you can put and href and prevent event’s default and still call

route(event.tartget.getAttribute('href'))
Read more comments on GitHub >

github_iconTop Results From Across the Web

Feature Request: <Link component> - remix-run/react-router
TLDR: This will create a consistent interface in both react-router-dom and react-router-native , allowing code reuse. I just started building an app using...
Read more >
Dealing with links in Next.js - LogRocket Blog
In this article, I'm going to explain two of my techniques for isolating routing in your application. I use Next as an example,...
Read more >
Link v6.6.1 - React Router
In react-router-dom , a <Link> renders an accessible <a> element with a real href that points to the resource it's linking to. This...
Read more >
next/link | Next.js
Client-side transitions between routes can be enabled via the Link component exported by next/link . For an example, consider a pages directory with...
Read more >
Routing libraries - Material UI - MUI
For instance, using Next.js's Link or react-router. ... If your component is extending ButtonBase , providing a href prop enables the link mode....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found