Join Samer Buna for an in-depth discussion in this video Computing dynamic values where needed, part of React Native Essential Training.
- [Narrator] It's time for us to write code…to determine if the game is won or lost.…This mean that while we're tapping on numbers,…we want to calculate the sum of the selected numbers.…This sum is going to effect the game status.…The game status can be one of three values.…It can be currently playing game status,…or it can be "Won" or it can be "Lost".…The thing is, this game status can be confusing.…
So we don't really need to put it on the state.…So what I'm going to do is create a new function here…and call it gameStatus,…and the goal of this function is…to compute the game status at any point.…So the first thing that we need…is the sum of selected number,…let's put that in a variable, call that sumSelected.…We can compute the sum of selected numbers…from the selected IDs that we put on the state.…
Because every time we select a number here,…we place its index ID on the state.…In fact, this selectedNumbers name…might be a bit misleading.…We're not placing the actual numbers on the state,…we're placing the positional order of each number,…
- 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.