Come on, I’ll give you an example and then explain separately ok ? okay
Example
Know in html when you call the img tag created by me
outside the component
<imgMy img="./SUaimg.jpg" CorFundo="red">Seu link</a>
Inside of the component
<div background-Color={this.props.CorFundo}> <img src={this.props.img}/> </div>
On the inside of the component You saw how I’m in charge props.Corfundo and props.img ? outside where I instate the component I call the same names and step parameters, in the case of what would be the background I send a color and what would be the src I would send an image.
State :
constructor(props) {
super(props)
this.state = {
aberto: true,
}
}
Let’s say the following I have another component that he expects an open parameter, when true it will open a window asking to log in, let’s see in practice.
<button onclick={() => {this.setState({ aberto: true })}}/>
<JanelaLogar estaAberto={this.sate.aberto}/>
when the open state is changed it will automatically change the parameter that was previously false to true and then the component will be changed also by being connected to the state, something they say is that the state is the state of truth, dynamic things in your app always, case by part not, will be linked to the state.
If you understand English, this article is excellent: https://kentcdodds.com/blog/props-vs-state
– Luiz Felipe