Description
Checks
- This is not a duplicate of an existing issue (please have a look through our open issues list to make sure)
- I have thoroughly read and understand The Odin Project Contributing Guide
- Would you like to work on this issue?
Describe your suggestion
re: the section included in the heading: "Rendering a list of components in JSX"
which includes a code fragment:
_
function ListItem(props) {
return{props.animal}
}function List(props) {
return (
{props.animals.map((animal) => {
return ;
})}
);
}function App() {
const animals = ["Lion", "Cow", "Snake", "Lizard"];return (
Animals:
);
}
_
and the following explanation:
_"We have moved our
element to a different component called . It still returns the
element, but we can do a lot more with it as a component.
This component accepts a props which is an object containing the animals that we defined as a property when we wrote . Do note that you can name it anything, for example, . You will still need to pass the animals to the property, but now you will use props.animalList instead of props.animals.
We have also created a different component for the
- element called , which also accepts props, and uses props.animal to render the text. It should now render the same thing."_
Correct me if I'm wrong, but at nowhere does the original instruction describe how the component accepts a prop. Normally with a function you expect an argument to be included within brackets. Here a component accepts an argument simply by having it written immediately after the name of the component. This is very confusing to those unfamiliar with React if it isn't explained or made explicit. There's an assumption that one already knows how props work, showing but not explaining.
I was really confused by this and resorted to chatGPT to explain it to me. The example is good. It can be followed. But the fact that this key piece of info is missing made me very confused and I got stuck on it for longer than I perhaps should have.
Also, THANK YOU so much to you all for your volunteer work and contributions. The entire course is pretty amazing.
Path
Node / JS
Lesson Url
https://www.theodinproject.com/lessons/node-path-react-new-rendering-techniques
(Optional) Discord Name
n/a
(Optional) Additional Comments
No response