## How do I pass an event handler (like onClick) to a component? ♥️from
Like
<button onClick={this.handleClick}>
then we need create a function in the class (📍 globle). ` handleClick() {console.log(‘Click happened’);
}`
## 🗺️ map : Array.prototype.map()
The map() method creates a new array populated with the results of calling a provided function on every element in the calling array. ♥️from returns a map object of the results after applying the given function to each item
The return value is an array of strings.
Each list item needs a unique a key.
is a new addition to the set of operators in ES6. It takes in an iterable (e.g an array) and expands it into individual elements.
allows an iterable to expand in places, use in the variable array where there is more than 1 value are expected, makes the code concise and readability,. It allows us the privilege to obtain a list of parameters from an array.
like:
const arr3 = [...arr1, ...arr2] //arr3 ==> [1,2,3,4,5,6]
sum(...numbers)
will retarn the sumation of the array like: [1, 2, 3] ➡️ 6
let person = {
` firstName: ‘moh’,lastName: ‘omar’,
};
let job = {
jobTitle: ‘JavaScript Developer’,
location: ‘JO’
};
let employee = {
…person,
…job
};` the Output : will be all elemint in one object.
### In the video, what is the first step that the developer does to pass functions between components?
<>
)
> onChange={this.handleChange}
### How does the child component invoke a method that was passed to it from a parent component?