I\'m trying to read state after it\'s modified within useEffect hook. However since useEffect closes over availability being empty array, it\'s not updated at all causing in