The way to do this is using refs. In your example you'd need to maintain a ref to the updated array, and access that from within useEffect. The ref will never change so you don't need worry about adding it as a dependency.