Use State and Touch Events in React Native

Tyler McGinnis
InstructorTyler McGinnis

Share this video with your friends

Send Tweet

In React, components manage their own state. In this lesson, we'll walk through building a component which manages it's own state as well as using TextInput and TouchableHighlight to handle touch events.

MyGov
MyGov
~ 6 years ago

Hint: It would be easier if in the constructor you would initialize the "username" param with your github username instead of blank. Otherwise, throughout this lesson, you will have to retype it over and over again.

Tyler McGinnis
Tyler McGinnisinstructor
~ 6 years ago

Though that would have saved some typing, it might have confused some people starting out with that initial state. A better solution I should have done in the video is to change the user I used rather than using myself every time.

Tiago Ferreira
Tiago Ferreira
~ 6 years ago

Isn't is possible to use => to replace the bind function in ES6 ?

Tyler McGinnis
Tyler McGinnisinstructor
~ 6 years ago

Yup. I always use =>, not sure why I didn't in the video.

srhise
srhise
~ 5 years ago

What syntax highlighting plugin are you using?? I love that red.

Tyler McGinnis
Tyler McGinnisinstructor
~ 5 years ago

Info in this tweet. https://twitter.com/tylermcginnis33/status/610920794189889536

Michael Lumbroso
Michael Lumbroso
~ 5 years ago

Quick question : I thought React provided autobinding => why not {this.handleChange} instead of {this.handleChange.bind(this)} ?

Thanks for the answer

jm90m
jm90m
~ 5 years ago

With the current version of React Native, I was not able to get my app to display. I had to remove "justifyContent: 'center', alignItems: 'center'," from container styles in 'index.ios.js'

Raunaq Sahni
Raunaq Sahni
~ 4 years ago

That wasn't React providing autobinding—it's because arrow functions are auto-bound to the lexical scope. Whereas is normal functions that isn't the case.