From 53c1320d6589f475ed7fb932652d5abc6fa9d9b6 Mon Sep 17 00:00:00 2001 From: Ken Date: Sun, 3 Mar 2019 14:08:41 -0800 Subject: [PATCH] fixing up some grammar in 2.4 --- step2-04/demo/README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/step2-04/demo/README.md b/step2-04/demo/README.md index 63cb37b..fda2fc8 100644 --- a/step2-04/demo/README.md +++ b/step2-04/demo/README.md @@ -49,7 +49,7 @@ All of these props are not used, except to be passed down to a child Component, ## React Context API -Let's solve these problems with the React Context API. Context is React's way to share data from components to their descendant children components without explicitly passing down through props at every level of the tree. In simpler terms, it solves the props drilling issue above! +Let's solve these problems with the React Context API. Context is React's way to share data from components to their descendant children components without explicitly passing down through props at every level of the tree. In simpler terms, it solves the props drilling issue mentioned above! React context is created by calling `createContext()` with some initial data. Use the `` component to wrap a part of the component tree that should be handed the context. @@ -84,7 +84,7 @@ class TodoApp extends React.Component { ### Consume context from a Class Component -Inside the children components, like the `` component, the value can be access from the component's `context` prop like this: +Inside a class-based child component, such as the `` component, the value can be accessed from the component's `context` property like this: ```js class TodoHeader extends React.Component { @@ -100,7 +100,7 @@ TodoHeader.contextType = TodoContext; ### Consume context from a Functional Component -If you're using the functional component syntax, you can access the context with the `useContext()` function. `useContext()` requires a recent release of React (16.8): +If you're using the functional component syntax, you can access the context with the `useContext()` hook. Note that `useContext()` requires a recent release of React (16.8): ```js const TodoFooter = props => { @@ -112,3 +112,5 @@ const TodoFooter = props => { ); }; ``` + +There is another legal syntax for accessing context with the ``, but we'll leave that out as an exercise for you!