Join Samer Buna for an in-depth discussion in this video Adding shared behavior to numbers, part of React Native Essential Training.
- [Instructor] Now we need to actually select the number…when we press on it.…To select a number, we just need to add its index…right here in the selectedNumbers array…that belongs to the state of the Game Component,…which means the Game Component should have function…that does exactly that.…So, let's called this function selectNumber…and it is a error function that will modify the state…and to select a number, just like isNumberSelected,…I need access to the numberIndex to be selected.…Again, I can't just select based on the number value,…I need the numberIndex.…
So, this function is basically going to set the state,…so it will return an object that has the new state…and inside this object,…we are going to change the selectedNumbers array…and basically push a new element…to that selectedNumbers array.…So, I have options here,…I can, for example, do something like selectedNumbers…and do the previous selectedNumbers…and then concat the new numbers to it,…however, I prefer to use the object spread property.…So, basically, I'd like to copy…
- Hello React Native on iOS and Android
- Styling React Native components
- Platform APIs
- Building a simple game app and a data-driven app
- Using the Fetch API
- Creating an animation loop
- Testing on Android
- Changing an app logo and a splash screen
- Using TestFlight with internal testers
Skill Level Intermediate
1. Getting Started
2. React Native Fundamentals
Hello React Native on iOS5m 42s
3. Building a Simple Game App
4. Building a Data-driven App
5. Animation and Gesture Control
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.