25
loading...
This website collects cookies to deliver better user experience
this.state
as shown below.prisonerOne
) by appending its name to this.state
.this.setState()
method. args
in this.setState(args)
is a represents the new value for some, or all, of the state variables. Here is an example of how this.setState()
can be used:prisonerOne
is “Piper Chapman” and the message displayed is the same as before.this.setState()
function is called and it changes the value of prisonerOne
to “Sam Healy”.ReceiverComponent
. The name
and location
are the props in this instance, but it can vary depending on the Component.this.props
in a way that resembles the use of this.state
.name
and location
props were accessed by appending name
and location
respectively to this.props
. What will be displayed is:props
as an argument in the function declaration, and using props
instead of this.props
in the body of the Stateless component.props
in the function declaration and refer to each prop directly in the body of the component.