Browse Source

Adds minor additions clarifying questions I had reading intro tutorial (#7595)

main
Robert Kielty 8 years ago
committed by Paul O’Shannessy
parent
commit
05138ac33a
  1. 4
      docs/tutorial.md

4
docs/tutorial.md

@ -181,7 +181,7 @@ Notice how we're mixing HTML tags and components we've built. HTML components ar
### Using props
Let's create the `Comment` component, which will depend on data passed in from its parent. Data passed in from a parent component is available as a 'property' on the child component. These 'properties' are accessed through `this.props`. Using props, we will be able to read the data passed to the `Comment` from the `CommentList`, and render some markup:
Let's create the `Comment` component, which will depend on data passed in from its parent, `CommentList`. Data passed in from a parent component is available as a 'property' on the child component. These 'properties' are accessed through `this.props`. Using props, we will be able to read the data passed to the `Comment` from the `CommentList`, and render some markup:
```javascript
// tutorial4.js
@ -219,7 +219,7 @@ var CommentList = React.createClass({
});
```
Note that we have passed some data from the parent `CommentList` component to the child `Comment` components. For example, we passed *Pete Hunt* (via an attribute) and *This is one comment* (via an XML-like child node) to the first `Comment`. As noted above, the `Comment` component will access these 'properties' through `this.props.author`, and `this.props.children`.
Note that we have passed some data from the parent `CommentList` component to the child `Comment` components. For example, we passed *Pete Hunt* (via the `author` attribute) and *This is one comment* (via an XML-like child node) to the first `Comment`. As noted above, the `Comment` component will access these 'properties' through `this.props.author`, and `this.props.children`.
### Adding Markdown

Loading…
Cancel
Save