Skip to content

v3.0.1

Choose a tag to compare

@prasanthreact prasanthreact released this 25 Jun 10:55
· 26 commits to main since this release

🚀 What’s New in vX.X.X

This update brings several powerful enhancements to react-next-router:


🧪 useAppRouter Hook

Now you can access a structured JSON of all matched routes using:

import { useAppRouter } from "react-next-router";

const DebugRoutes = () => {
  const router = useAppRouter();
  console.log(router);
  return <pre>{JSON.stringify(router, null, 2)}</pre>;
};

Useful for custom RouterProvider or advanced route inspection.


🔁 Outlet Automatically Becomes children

No need to manually use <Outlet /> anymore!
Your layout.jsx files now receive children directly:

export default function RootLayout({ children }) {
  return <main>{children}</main>;
}

📦 loader.jsx Support

Place a loader.jsx next to any page.jsx to fetch data before rendering:

// app/about/loader.jsx
export default async function loader() {
  return { message: "Hello from the loader!" };
}

Data returned will be passed to page.jsx as the data prop.


pending.jsx Support

Add a pending.jsx inside /app to show a loading UI while loader.jsx is running:

export default function Pending() {
  return <div>Loading...</div>;
}

That’s it for this release — focused, practical, and ready to level up your routing experience.
Let us know what you build! 🚀

npm - https://www.npmjs.com/package/react-next-router