As explained stateItem throws an error, and when I console.log stateItem after I set the state it comes out as null. Can someone please tell me why this happens? The code is below:
const [stateItem, setStateItem] = useState(null);<SwipeListView data={list} listKey={'list'} keyExtractor={list=> list.id} closeOnScroll={true} closeOnRowBeginSwipe={true} renderItem={({ item }) => (<View><TouchableWithoutFeedback onPress={() => { setStateItem(item);><View><Text>{item.category}</Text></View></TouchableWithoutFeedback></View> )} />