From 564fa646262300683e2c0212fe12bcb0ae5e7daf Mon Sep 17 00:00:00 2001 From: MICHAEL JACKSON Date: Mon, 30 Jan 2017 09:36:47 -0800 Subject: [PATCH] Update context example for react-router v4 beta (#8889) * Update context example for react-router@4.0.0-beta.1 * Style nits --- docs/docs/context.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/docs/context.md b/docs/docs/context.md index 3ae11fe8b1..c5703d3545 100644 --- a/docs/docs/context.md +++ b/docs/docs/context.md @@ -108,9 +108,11 @@ If `contextTypes` is not defined, then `context` will be an empty object. ## 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 +import { Router, Route, Link } from 'react-router-dom'; + const BasicExample = () => (
@@ -120,17 +122,17 @@ const BasicExample = () => (
  • Topics
  • -
    +
    - - - + + +
    -) +); ``` -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.