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: packages/react-router/docs/guides/migrating.md
+27Lines changed: 27 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,7 @@ React Router v4 is a complete rewrite, so there is not a simple migration path.
10
10
*[on* properties](#on-properties)
11
11
*[Switch](#switch)
12
12
*[Redirect](#redirect)
13
+
*[PatternUtils](#patternutils)
13
14
14
15
## The Router
15
16
@@ -169,3 +170,29 @@ In v4, you can achieve the same functionality using `<Redirect>`.
169
170
</Switch>
170
171
171
172
```
173
+
174
+
## PatternUtils
175
+
176
+
### matchPattern(pattern, pathname)
177
+
In v3, you could use the same matching code used internally to check if a path matched a pattern. In v4 this has been replaced by [matchPath](/packages/react-router/docs/api/matchPath.md) which is powered by the [path-to-regexp](https://github.com/pillarjs/path-to-regexp) library.
178
+
179
+
### formatPattern(pattern, params)
180
+
In v3, you could use PatternUtils.formatPattern to generate a valid path from a path pattern (perhaps in a constant or in your central routing config) and an object containing the names parameters:
In v4, you can achieve the same functionality using the [compile](https://github.com/pillarjs/path-to-regexp#compile-reverse-path-to-regexp) function in [path-to-regexp](https://github.com/pillarjs/path-to-regexp).
0 commit comments