Triangle Walks
Triangle Walks
This is one of my favourite songs from one of my favourite albums - Fever Ray by Fever Ray.
I love it and it has a magical fairy tale vibe to it.
I also like the feeling within it - "Who is that, to come by my house" - of setting a boundary.
Rendering a Component's Props
Continuing with yesterday's example
Also there's this bit as well...
Passing props From Component to Component
"The most common use of props is to pass information to a component from a different component.
Props in React travel in a one-way direction, from the top to bottom, parent to child."
"Props passed down are immutable, meaning they cannot be changed. If a component wants new values for its props, it needs to rely on the parent component to pass it new ones."
handleEvent, onEvent, and props.onEvent
"When you pass an event handler as a prop, as you just did, there are two names that you have to choose. Both naming choices occur in the parent component. the component that defines the event handler and passes it.
The first name that you have to choose is the name of the event handler itself.
[...]
The secon d name that you have to choose is the name of the prop that you will use to pass the event handler.
This is the same thing as the attribute name."
props.children
"Every component's props object has a property named children.
props.children will return everything in between a component's opening and closing JSX tags.
Default props
Okay, I am exhausted, but I LOVE this concept. "There are three ways of doing this".
THIS IS THE MOST CONFUSING THING IN THE WORLD TO IMPLEMENT IN PRACTICE.
I am too exhausted to read anything so I'm just going to put this here to understand it better.
Here is another way/thingymajiggy:
Here is another way/thingymajiggy:
And the third one:
One of my Seniors came to save me (I LOVE MY SENIOR ENGINEERS).
And he told me that: the best option is the second one.
Default parameters in React are confusing anyway - but he told me that the best option to default to (get it?) was the second option.
I need to do some more work on destructuring.
There is a lot that I need to learn about this.
Comments
Post a Comment