Skip to main content

Drop

Key concepts: Communication between UI thread and JS thread

Resources

Threads

But what if I want to run certain processes in one thread, but call them from the other? For example, what if we wanted to set a React State from a gesture handler? Well, take a look at the docs for these two functions:

Challenge

In this challenge we’ll count how many times Slimy has been dropped.

💡 TIPS && HINTS:
  • Probably we would want to save this in a state.
  • You don’t have to change the background color. I did it just to reinforce the concept.

❔ Questions to consider:

  • How can you be sure that the counter will increment after the animation ended?