Be carefull... that postList.list as dependencies will make your component enter an infinite loop of rerenders. It is better to access this property via an arrow function.
postList.list
useEffect(() => { setPostList((x) => ({ list: x.concat([1, 1, 1, 1]), })) }, [page])
Also, handleObserver is better to be insde the useEffect function and you should clear (observer.unobserve) the listener on a callback funtion. ;)
handleObserver
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Be carefull... that
postList.list
as dependencies will make your component enter an infinite loop of rerenders. It is better to access this property via an arrow function.Also,
handleObserver
is better to be insde the useEffect function and you should clear (observer.unobserve) the listener on a callback funtion. ;)