Liking Images

Learn about integrating XState state machines into a React Native app for handling image likes, updating state, and addressing rendering challenges with FlatList through explicit data changes.

Our state machines are aware of the array of images we have fetched and that we display on the FavoritedImages surface. They also become aware of the currently seen image through the MODAL_OPEN action. Now, we need to tell them what to do if someone presses the like button.

Adding the like action

Let’s add a new action to the likeImagesMachine function:

Get hands-on with 1400+ tech skills courses.