mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-22 21:08:12 +08:00
fix(curriculum): modified instruction structuring (#50689)
Co-authored-by: Anmol Sarraf <anmolsarraf@Anmols-MacBook-Pro.local>
This commit is contained in:
parent
ae16ebfd58
commit
758d46d70b
@ -16,11 +16,17 @@ The last challenge demonstrated how to pass information from a parent component
|
||||
</ParentComponent>
|
||||
```
|
||||
|
||||
The child component then has access to the array property `colors`. Array methods such as `join()` can be used when accessing the property. `const ChildComponent = (props) => <p>{props.colors.join(', ')}</p>` This will join all `colors` array items into a comma separated string and produce: `<p>green, blue, red</p>` Later, we will learn about other common methods to render arrays of data in React.
|
||||
The child component then has access to the array property `colors`. Array methods such as `join()` can be used when accessing the property.
|
||||
|
||||
```jsx
|
||||
const ChildComponent = (props) => <p>{props.colors.join(', ')}</p>
|
||||
```
|
||||
|
||||
This will join all `colors` array items into a comma separated string and produce: `<p>green, blue, red</p>`. Later, we will learn about other common methods to render arrays of data in React.
|
||||
|
||||
# --instructions--
|
||||
|
||||
There are `List` and `ToDo` components in the code editor. When rendering each `List` from the `ToDo` component, pass in a `tasks` property assigned to an array of to-do tasks, for example `["walk dog", "workout"]`. Then access this `tasks` array in the `List` component, showing its value within the `p` element. Use `join(", ")` to display the `props.tasks` array in the `p` element as a comma separated list. Today's list should have at least 2 tasks and tomorrow's should have at least 3 tasks.
|
||||
There are `List` and `ToDo` components in the code editor. When rendering each `List` from the `ToDo` component, pass in a `tasks` property assigned to an array of to-do tasks, for example `["walk dog", "workout"]`. Then access this `tasks` array in the `List` component, showing its value within the `p` element. Use `join(", ")` to display the `props.tasks` array in the `p` element as a comma-separated list. Today's list should have at least 2 tasks and tomorrow's should have at least 3 tasks.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user