Standards for useNavigate and useRouter for creating npm package

I am making an npm package that I hope that both nextjs and react developers can use. In my package, i use useRouter to do a router.push to change routes. Is there a way people standardize this to support this functionality regardless of if someone uses React (like a Vite app) or NextJs?
2 Replies
ar
arOP14mo ago
And i tried just defaulting to just using useRouter in my npm package but then i get an error: Error: NextRouter was not mounted.
jackmcbride_98
jackmcbride_9814mo ago
You will probably have to make different versions for react-router and next-router They can be in the same library, just different exports
Want results from more Discord servers?
Add your server