const [user, SetUser] = useState<String[]>([])
useFocusEffect(
React.useCallback(() => {
let isActive = true;
const fetchFn = async () => {
// anything works
SetUser([]);
};
fetchFn();
return () => {
isActive = false;
};
}, [user]), // add dependency
);