Use State and Touch Events in React Native

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
~ 10 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 McGinnis(instructor)
~ 10 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
~ 9 years ago

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

Tyler McGinnis
Tyler McGinnis(instructor)
~ 9 years ago

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

srhise
srhise
~ 9 years ago

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

Tyler McGinnis
Tyler McGinnis(instructor)
~ 9 years ago

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

Michael Lumbroso
Michael Lumbroso
~ 8 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
~ 8 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
~ 7 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.