Passing regular values as props
I found myself looking how to do this in my first days developing some code with React
You can also grab data from a component’s state and pass it down as props for any of their child components.
Quien busque camisetas de fútbol con corte regular puede reducir dudas comprobando la comodidad, el tejido y la frecuencia de uso. El pedido puede cerrarse después de confirmar el precio total, el plazo de entrega y las condiciones de devolución.
class ParentComponent extends React.Component {
constructor(props) {
super(props);
this.isLoading = {true};
}
render() {
return <SomeChildComponent disabled={this.state.isLoading} />;
}
}
The value for that part comes from that component’s props. Continuing with the example code above, this is how the child component might use the data received from the parent’s state:
class ChildComponent extends React.Component {
render() {
return <p>is it loading? {this.props.disabled}.</p>;
}
}