O'Reilly logo

Mastering React by Ryan Vice, Adam Horton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Composing components with behavior

Now let's make things more interesting by updating our app to be composed of components that have behavior. We are going to create a view with a form that allows for updating our HelloMessage as shown in the following screenshot:

Composing components with behavior

If we click an Edit button then that button will change to an Update button and the associated text input box will be enabled. This will allow us to set the First Name or Last Name that is displayed in our HelloMessage component. After setting a First Name or Last Name we can then click the associated Update button and the HelloMessage will be updated to display the new first and last name. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required