Closed mocheng closed 1 year ago
Thanks for your suggestion. It totally makes sense, I'll look into it!
For the time being, I just created a wrapper component of Link
from next-routes
. That wrapper renders Link
from a singleton instance created by next-routes
at runtime. It works in some way, but the wrapper-over-wrapper-over-next-link may be expensive.
Pretty please. I want to publish a package compatible with next-routes
out of the box.
@fridays I'd be happy to give this a shot and make a PR. Any tips or pointers before I get started?
Is anyone still working on this? I'd love to have this.
I found that
next-routes
API is not friendly.In
next.js
, each component could just depend onnext/link
. So, component can reside in a standalone repo and published as npm package. However, when utilizingnext-routes
, I have to importLink
fromroutes.js
file specific to given application. As a result, there is no way to create a standalone component to be shared.How about making
Link
andRouter
accessible by singleton object innext-routes
? Like thisInternally, when
next-routes
is executed to create instance, the instance is saved as singleton to be exposed bynext-routes/link
andnext-routes/router
.