Using href directly in Link
See original GitHub issueHi, I have a url that is part of the data. I tried using the href value directly instead of params
and route
but it seems to be doing a full page navigation. Is it expected?
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
HTML Link – How to Insert a Link to a Website with HREF Code
The href is an attribute used to reference another document. You can find it on link tags and anchor tags. The href attribute...
Read more >HTML Links Hyperlinks - W3Schools
The most important attribute of the <a> element is the href attribute, which indicates the link's destination. The link text is the part...
Read more >What Are a Href Links? HTML Links Explained - Semrush
The href attribute link (short for “Hypertext REFerence”) indicates the relationship between pages to search engines. href is an attribute of ...
Read more >How to use a href in HTML for adding links to your website
a href is used to include external and internal links on a website. The authorized values for the HTML attribute href are clearly...
Read more >HTML Anchors: Here's How To Create Links For Fast ...
An href can do a lot more than just link to another website. It can be used to link directly to any element...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
When using only
href
, it’s not handled by next-routes but passed to the original Link component, which expects a corresponding file in the pages folder (therefore the 404). To use the route defined in routes.js, do it like this:Alternatively next.js lets you decorate the displayed URL in any way, but you need to tell it which page to render and pass the params. That’s what next-routes normally does for you. You can do it manually like this:
Check out the docs here: https://github.com/zeit/next.js#with-link
Hope it helps!
Without add
params
androute
to Link, it causes a full page reload. Also, the client displays a brief 404 before showing the new page again.Cheers 😃