clear-react-router 1.1.3 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/index.js +1 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -131,6 +131,14 @@ useEffect(() => {
|
|
|
131
131
|
|
|
132
132
|
Executes a callback when the page is about to be closed or reloaded. Perfect for auto-saving data at the last moment.
|
|
133
133
|
|
|
134
|
+
### `useRouterContext()`
|
|
135
|
+
|
|
136
|
+
Handles router context.
|
|
137
|
+
```
|
|
138
|
+
const { setContext, context } = useRouterContext();
|
|
139
|
+
const loginHandler = () => setContext({ ...context, user: { name: 'John' } });
|
|
140
|
+
```
|
|
141
|
+
|
|
134
142
|
**Parameters:**
|
|
135
143
|
|
|
136
144
|
| Parameter | Type | Description |
|
package/dist/index.js
CHANGED
|
@@ -193,10 +193,7 @@ var useHandleNavigation = ({ setLocation, routeList, context, revalidateCache })
|
|
|
193
193
|
to: newLocation.pathname
|
|
194
194
|
});
|
|
195
195
|
history.pushState(null, "", prevPathname.current);
|
|
196
|
-
} else
|
|
197
|
-
console.log(newLocation);
|
|
198
|
-
setNextLocationRef.current(newLocation);
|
|
199
|
-
}
|
|
196
|
+
} else setNextLocationRef.current(newLocation);
|
|
200
197
|
};
|
|
201
198
|
window.addEventListener("popstate", handler);
|
|
202
199
|
return () => window.removeEventListener("popstate", handler);
|