So I am relatively new to react and have some basic understanding of Javascript. I was following this tutorial and while the instructor move forward everything seemed to be clear but then, When I started to read again, I am unable to understand this
render() {
let person = null;
if (this.state.showPerson) {
person= (
<div>
{
this.state.person.map((el, index) => {
return <Person
key={el.id}
click={this.deletePersonHandler.bind(index)}
name={el.name}
age={el.age}
changed={(event) => this.eventSwitchHandler(event, el.id)} />
})
}
</div>
);
}
While, I know what it does and use of if-statement
, I am having tough time figuring out what does this mean in Javascript or react
person= (......
.....)
**console.log(typeof person)**
states it to be an object but this doesn't seem to be an object. So what exactly is this and why have the instructor used it (Below is my html inside return and I know it is being used to add content dynamically)
return (
<div className={classes.App}>
<h1> Hi I am react App</h1>
<p className={classese}>
hey </p>
<button className={btnClass}
onClick={this.togglerPersonHandler}>Button</button>
{person}
</div>
)