skip to Main Content

React Native – useState not updating immediatly

I'm trying to update my state when onLongPress triggered. I'm printing the result right after the setState but it shows nothing (on the first press) Code: const [pressedImagesm setPressedImages] = useState([]); ... onLongPress={() => { setPressedImages(oldArray => [...oldArray, { [index]:…

VIEW QUESTION
Back To Top
Search