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
+3-7
Original file line number
Diff line number
Diff line change
@@ -74,7 +74,7 @@ const MyComponent = mock();
74
74
-[`<Provider>`](./docs/en/Provider.md#provider), [`<Consumer>`](./docs/en/Provider.md#consumer), [`withContext()`](./docs/en/Provider.md#withcontext-hoc), and [`@withContext`](./docs/en/Provider.md#withcontext-decorator)
75
75
-[`<Theme>`](./docs/en/theme.md#theme), [`<Themed>`](./docs/en/theme.md#themed), [`withTheme()`](./docs/en/theme.md#withtheme-hoc), and [`@withTheme`](./docs/en/theme.md#withtheme-decorator)
76
76
-[`<CssVarsProvider>`](./docs/en/cssvars.md), [`<CssVars>`](./docs/en/cssvars.md#cssvars), [`withCssVars()`](./docs/en/cssvars.md#withcssvars-hoc), and [`@withCssVars`](./docs/en/cssvars.md#withcssvars-decorator)
77
-
-[`<Router>`](./docs/en/routing.md#router), [`<Route>`](./docs/en/routing.md#route), [`withRoute()`](./docs/en/routing.md#withroute), `@withRoute`, `go()`, and `<Go>`
77
+
-[Router](./docs/en/routing.md)
78
78
-[`<Translations>`](./docs/en/translate.md#translations), [`<Translate>`](./docs/en/translate.md#translate-or-t), [`<T>`](./docs/en/translate.md#translate-or-t), [`withT()`](./docs/en/translate.md#witht-hoc), and [`@withT`](./docs/en/translate.md#witht-decorator)
79
79
-[UI](./docs/en/UI.md)
80
80
-[`<Portal>`](./docs/en/Portal.md), [`<Overlay>`](./docs/en/Overlay.md), and [`<Modal>`](./docs/en/Modal.md)
-[`go()`](./docs/en/routing.md#go), `<Redirect>`, `<Link>`, [`<Sms>`](./docs/en/Sms.md), [`<Mailto>`](./docs/en/Mailto.md), and `<Tel>`
103
+
-[`go()`](./docs/en/routing.md#go), [`<Sms>`](./docs/en/Sms.md), [`<Mailto>`](./docs/en/Mailto.md), and `<Tel>`
104
104
-[Boundaries](./docs/en/Boundaries.md)
105
105
-[`<BrowserOnly>`](./docs/en/BrowserOnly.md), [`<ServerOnly>`](./docs/en/ServerOnly.md), and [`<ElectronOnly>`](./docs/en/ElectronOnly.md)
106
106
-[`<ErrorBoundary>`](./docs/en/ErrorBoundary.md) and [`withErrorBoundary()`](./docs/en/ErrorBoundary.md#witherrorboundary-hoc)
107
107
-`<CacheBoundary>`
108
108
-[NEXT](./docs/en/next.md)
109
109
-[`createRef()`](./docs/en/next/createRef.md), [`createState()`](./docs/en/next/createState.md), and [`createLifecycleEvents()`](./docs/en/next/createLifecycleEvents.md)
Copy file name to clipboardExpand all lines: docs/en/README.md
+3-6
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,7 @@
44
44
-[`<Provider>`](./Provider.md#provider), [`<Consumer>`](./Provider.md#consumer), [`withContext()`](./Provider.md#withcontext-hoc), and [`@withContext`](./Provider.md#withcontext-decorator)
45
45
-[`<Theme>`](./theme.md#theme), [`<Themed>`](./theme.md#themed), [`withTheme()`](./theme.md#withtheme-hoc), and [`@withTheme`](./theme.md#withtheme-decorator)
46
46
-[`<CssVarsProvider>`](./cssvars.md), [`<CssVars>`](./cssvars.md#cssvars), [`withCssVars()`](./cssvars.md#withcssvars-hoc), and [`@withCssVars`](./cssvars.md#withcssvars-decorator)
47
-
-[`<Router>`](./routing.md#router), [`<Route>`](./routing.md#route), [`withRoute()`](./routing.md#withroute), `@withRoute`, `go()`, and `<Go>`
47
+
-[Router](./routing.md)
48
48
-[`<Translations>`](./translate.md#translations), [`<Translate>`](./translate.md#translate-or-t), [`<T>`](./translate.md#translate-or-t), [`withT()`](./translate.md#witht-hoc), and [`@withT`](./translate.md#witht-decorator)
49
49
-[UI](./UI.md)
50
50
-[`<Portal>`](./Portal.md), [`<Overlay>`](./Overlay.md), and [`<Modal>`](./Modal.md)
Copy file name to clipboardExpand all lines: docs/en/routing.md
+31-66
Original file line number
Diff line number
Diff line change
@@ -10,14 +10,17 @@ Reference:
10
10
11
11
-[`<Router>`](#router)
12
12
-[`<Route>`](#route)
13
+
-[`<Switch>`](#switch)
14
+
-[`<Match>`](#match)
15
+
-[`<Link>`](#link)
13
16
-[`go()`](#go)
14
-
-[`withRoute()`](#withroute)
17
+
-[`createRouter()`](#createrouter)
15
18
16
19
17
20
## Use any state container
18
21
19
22
With libreact's `<Router>` you can choose to store the current route in your state continer (like Redux or MobX) of
20
-
choice, or not bother about it at all, in which case the `<Router>` will just use the current browser location out-of-the-box.
23
+
choice.
21
24
22
25
The "problem-of-all-routers" is that they all want to keep the state of the route. For example, [`react-router`](https://reacttraining.com/react-router/) uses
23
26
its internal history objects to store route information, and [it does not give you good access to that data structure](http://formidable.com/blog/2016/07/11/let-the-url-do-the-talking-part-1-the-pain-of-react-router-in-redux/).
@@ -65,8 +68,7 @@ You can have many routers operating on the same page in parallel. All you have t
65
68
</Router>
66
69
```
67
70
68
-
This allows you to route by basically anything, not just the current page location. You can have *app-inside-app* that has its
69
-
own routing logic.
71
+
You can have *app-inside-app* that has its own routing logic.
70
72
71
73
72
74
## Reference
@@ -79,68 +81,41 @@ its children.
79
81
80
82
#### Props
81
83
82
-
-`route` - optional, string, route to use for routing. If not specified, `<Router>` will use
83
-
[`<LocationSensor>`](./LocationSensor.md) internally to track any changes to `window.location`.
84
-
-`ns` - optional, string, namespaces of the router. This allows you to have many different routers
84
+
-`route`— required, string, route to use for routing. If not specified, `<Router>` will use
85
+
-`ns`— optional, string, namespaces of the router. This allows you to have many different routers
85
86
on one page, each in a separate namespace.
86
87
87
-
Unlike other routing libraries `<Router>` component lets you specify the current route manually using the `route` property,
88
-
this way you can use Redux or MobX, or any other state container library to store your route, if you want to.
88
+
Unlike in other routing libraries `<Router>` component forces you specify the current route manually using the `route` property,
89
+
this way you can use Redux or MobX, or any other state container library to store your route.
89
90
90
91
91
92
### `<Route>`
92
93
93
94
`Route` tries to match a fragment in a route. If it does match, the contents of the route is rendered. The contents of the route
94
-
can be either regular JSX children or a FaCC or a React component specified in the `comp` prop.
95
+
can be either regular JSX children or a FaCC, render prop, or component prop.
95
96
96
97
97
98
#### Props
98
99
99
-
-`match`, optional, matching condition, defaults to `/.+/`, see discussion below.
100
+
-`match`— optional, matching condition, defaults to empty string. This can be a regular expression.
101
+
-`exact`— optiona, boolean, whether string route has to match exactly.
102
+
-`truncate`— optiona, boolean, whether matched part of the route should be truncated for the nested routes.
103
+
-`ns`— optional, string, namespace of the router.
100
104
101
-
The props object has the following TypeScript signature
0 commit comments