You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+32-2Lines changed: 32 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -137,7 +137,9 @@ export default App;
137
137
|`app/blog/[slug]/loader.jsx`| Data loader for `/blog/:slug`|
138
138
|`app/loading.jsx`| Loading UI while data is fetched |
139
139
140
-
## 🧪 useAppRouter Hook
140
+
141
+
142
+
## 🪝 useAppRouter Hook
141
143
142
144
You can now use the useAppRouter() hook to get a JSON structure of all matched routes. This is useful when you want to inspect or manipulate the route config manually — for example, inside a custom RouterProvider or createBrowserRouter setup.
143
145
@@ -151,7 +153,35 @@ const MyComponent = () => {
151
153
};
152
154
```
153
155
154
-
---
156
+
157
+
## 🪝 useNextParams Hook
158
+
159
+
The `useNextParams` hook lets you easily access dynamic route parameters (like `[slug]`, `[...slug]`) in your components. recommended for use in pages that have dynamic segments instead of using `useParams` from React Router.
160
+
161
+
```jsx
162
+
import { useNextParams } from"react-next-router";
163
+
164
+
exportdefaultfunctionBlogPost() {
165
+
constparams=useNextParams();
166
+
// For a route like /blog/hello, params.slug === 'hello'
167
+
// For a catch-all route like /blog/a/b, params.slug === ['a', 'b']
0 commit comments