Join Samer Buna for an in-depth discussion in this video Remounting a component to reset it, part of React Native Essential Training.
- [Instructor] Let's do one last feature for this game.…Let's create a Play Again button,…once the game is won or lost.…We'll start with the mark-up for that button.…Let's place it in this area under the numbers.…We can use the button component from 'react-native'.…Here is the documentation for the button component.…We give an onPress event and a title for that button.…Let's do that.…We'll place it right here under the View Button,…with a title of Play Again…and we'll figure out the onPress next.…
Let's see how that looks.…We can see how actually the onPress is a required property.…So let's provide an empty onPress function.…Here's the button, looks decent.…So what should this button do?…This button should completely reset the game.…Which means it has to reset the State of the game,…but also it means that we have…to generate a new target number.…We have to generate a new set of random numbers and we…also have to reset any timers that we did in the game.…
So a simple reset for this State is not going to do.…We could think about moving all the initialization of…
- 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.