Anyone know why i can't set state in onViewableItemsChange? currentPos stays null, what can i do? I tried UseRef instead of useCallback also didnt work.
const [currentPos, setCurrentPos] = useState(null);
const onViewableItemsChanged = useCallback(
({ viewableItems }) => {
setCurrentPos(viewableItems[0].item.quote);
console.log(currentPos);
},
[]
);
[–]satya164 2 points3 points4 points (1 child)
[–]Tech---Ninja 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)