1

I have a code like this, I want the state to work only on the element of the array on which I click, and not on everything. if I'm not mistaken, in js it is used "this".

{ORDER_HISTORY.map((item) => {
 return (
    <TouchableOpacity key={item.id} onPress={thisBlockWillBeRevealed}>
        <Text>{item.text}</Text>
    </TouchableOpacity> })}

Video: https://www.dropbox.com/s/1wbc5y6ngerpr35/RPReplay_Final1639308045.MP4?dl=0

George
  • 67
  • 1
  • 5
  • Its not a React Native specific, you are looking for a way to manage multiple states. In this case you trying to have a separate state for each item and update your `thisBlockWillBeRevealed` callback, see duplicate for examples – Dennis Vash Dec 12 '21 at 11:39

0 Answers0