@ -108,9 +108,11 @@ If `contextTypes` is not defined, then `context` will be an empty object.
## Parent-Child Coupling
## Parent-Child Coupling
Context can also let you build an API where parents and children communicate. For example, one library that works this way is [React Router V4](https://react-router.now.sh/basic):
Context can also let you build an API where parents and children communicate. For example, one library that works this way is [React Router V4](https://reacttraining.com/react-router):
```javascript
```javascript
import { Router, Route, Link } from 'react-router-dom';
const BasicExample = () => (
const BasicExample = () => (
<Router>
<Router>
<div>
<div>
@ -120,17 +122,17 @@ const BasicExample = () => (
<li><Linkto="/topics">Topics</Link></li>
<li><Linkto="/topics">Topics</Link></li>
</ul>
</ul>
<hr/>
<hr/>
<Matchexactlypattern="/"component={Home}/>
<Routeexactpath="/"component={Home}/>
<Matchpattern="/about"component={About}/>
<Routepath="/about"component={About}/>
<Matchpattern="/topics"component={Topics}/>
<Routepath="/topics"component={Topics}/>
</div>
</div>
</Router>
</Router>
)
);
```
```
By passing down some information from the `Router` component, each `Link` and `Match` can communicate back to the containing `Router`.
By passing down some information from the `Router` component, each `Link` and `Route` can communicate back to the containing `Router`.
Before you build components with an API similar to this, consider if there are cleaner alternatives. For example, you can pass entire React component as props if you'd like to.
Before you build components with an API similar to this, consider if there are cleaner alternatives. For example, you can pass entire React component as props if you'd like to.