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.

Suggest to have `Link` and `Router` to be accessed by singleton

See original GitHub issue

I found that next-routes API is not friendly.

In next.js, each component could just depend on next/link. So, component can reside in a standalone repo and published as npm package. However, when utilizing next-routes, I have to import Link from routes.js file specific to given application. As a result, there is no way to create a standalone component to be shared.

import {Link} from 'path/to/routes';

How about making Link and Router accessible by singleton object in next-routes? Like this

import {Link} from 'next-routes/link';
import {Router} from 'next-routes/router';

Internally, when next-routes is executed to create instance, the instance is saved as singleton to be exposed by next-routes/link and next-routes/router.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:16
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
fridayscommented, Jul 4, 2017

Thanks for your suggestion. It totally makes sense, I’ll look into it!

2reactions
RobertB4commented, Jul 13, 2018

Is anyone still working on this? I’d love to have this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Suggest to have `Link` and `Router` to be accessed by singleton
I found that next-routes API is not friendly. In next.js , each component could just depend on next/link . So, component can reside...
Read more >
URLs and Routing
How to define client and server routes for your app using Flow Router. How to have your app display different content depending on...
Read more >
Singleton services
There are two ways to make a service a singleton in Angular: ... has a Router and the root application components can access...
Read more >
How to make Angular2 Service singleton?
I'm trying to implement an auth guard in my app. ie; Only authenticated users can access certain routes ...
Read more >
In-app navigation: routing to views - Angular
To use the Angular router, an app needs to have at least two components so that it can navigate from one to ......
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