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
@@ -408,7 +408,7 @@ The route that rendered this component.
408
408
A subset of `this.props.params` that were directly specified in this component's route. For example, if the route's path is `users/:userId` and the URL is `/users/123/portfolios/345` then `this.props.routeParams` will be `{userId: '123'}`, and `this.props.params` will be `{userId: '123', portfolioId: 345}`.
409
409
410
410
#### `children`
411
-
The matched child route elements to be rendered.
411
+
The matched child route element to be rendered. If the route has [named components](https://github.com/rackt/react-router/blob/master/docs/API.md#named-components) then this will be undefined, and the components will instead be available as direct properties on `this.props`.
412
412
413
413
##### Example
414
414
```js
@@ -434,7 +434,7 @@ class App extends React.Component {
434
434
```
435
435
436
436
### Named Components
437
-
When a route has multiple components, the child elements are available by name on `this.props.children`. All route components can participate in the nesting.
437
+
When a route has one or more named components, the child elements are available by name on `this.props`. In this case `this.props.children` will be undefined. All route components can participate in the nesting.
438
438
439
439
#### Example
440
440
```js
@@ -456,11 +456,11 @@ class App extends React.Component {
456
456
<div>
457
457
<div className="Main">
458
458
{/* this will either be <Groups> or <Users> */}
459
-
{this.props.children.main}
459
+
{this.props.main}
460
460
</div>
461
461
<div className="Sidebar">
462
462
{/* this will either be <GroupsSidebar> or <UsersSidebar> */}
463
-
{this.props.children.sidebar}
463
+
{this.props.sidebar}
464
464
</div>
465
465
</div>
466
466
)
@@ -472,8 +472,8 @@ class Users extends React.Component {
472
472
return (
473
473
<div>
474
474
{/* if at "/users/123" this will be <Profile> */}
475
-
{/* UsersSidebar will also get <Profile> as this.props.children,
476
-
you pick where it renders */}
475
+
{/* UsersSidebar will also get <Profile> as this.props.children.
476
+
You can pick where it renders */}
477
477
{this.props.children}
478
478
</div>
479
479
)
@@ -482,7 +482,6 @@ class Users extends React.Component {
0 commit comments