From the course: React Native Essential Training
Unlock the full course today
Join today to access over 24,000 courses taught by industry experts.
Using TouchableOpacity for press events - React Native Tutorial
From the course: React Native Essential Training
Using TouchableOpacity for press events
- [Instructor] Our next step is to click these numbers and start to think about what should happen when we do. Now, these numbers are so far presented here with just a text element. And since we're going to click on that text element and that click is potentially going to need the random number value. Since it's going to trigger a computation of the (mumbles) that's our sign that we need a component to represent every clickable number. Whenever you have something that you need to click on and you need the value related to that thing that you click on, it's your sign that you need a component. The other sign that we actually needed a component here is that we are rendering six similar things, they're all random numbers. They share markup, they share style and they're also now going to share behavior. Whenever we click on each of these six, the behavior is basically the same. These are our signs that we need a component…
Contents
-
-
-
-
-
(Locked)
Introduction and preview42s
-
(Locked)
Initializing the TargetSum app4m 36s
-
(Locked)
Configuring ESLint1m 47s
-
The game component with a random target3m 54s
-
(Locked)
Generating the random play numbers9m 41s
-
(Locked)
Styling the random play numbers2m 23s
-
(Locked)
Using TouchableOpacity for press events6m 17s
-
(Locked)
Changing UI based on selected numbers7m 31s
-
(Locked)
Adding shared behavior to numbers6m 21s
-
(Locked)
Using React DevTools with React Native4m 24s
-
(Locked)
Computing dynamic values where needed5m 14s
-
(Locked)
Changing UI based on game status4m 5s
-
(Locked)
Working with timers6m 16s
-
(Locked)
Caching to optimize computable values8m
-
(Locked)
Remounting a component to reset it7m 30s
-
(Locked)
-
-
-
-