Join Samer Buna for an in-depth discussion in this video Caching to optimize computable values, part of React Native Essential Training.
- [Instructor] In the previous video,…we implemented an interval timer…to limit the time a user has to play the game,…and we identified that the computation of the gameStatus…is now not needed every second,…but rather, when the number is clicked…or when the timer hits zero.…To optimize this computation, we need to cache it.…Let's do that.…Instead of this .gameStatus as a function,…I'm going to assume the gameStatus is a fixed number…that I have cached on the instance.…This gameStatus starts with playing.…
So in here, I'll introduce a gameStatus,…instance property, and this one starts with Playing.…And now, I need to change this gameStatus,…the cached copy of the computed value.…I need to change that when needed,…and I can do so in componentWillUpdate.…This life cycle method happens…right before the render method,…when the component is about to be updated,…when the state of the component is different,…or when the props of the component is different.…
So I actually conditionally here,…I can compute the new gameStatus if there is a need to.…
- 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.