Skip to content

Why is my component logging continuously by using mobx & react-table #5563

Answered by jgarplind
wq758511990 asked this question in Q&A
Discussion options

You must be logged in to vote

An educated guess: Maybe because you are setting data as [] every time.

An empty array is not equal to another empty array, so React sees something has changed and re-renders, causing the same thing to happen time and time again.

The docs are pretty clear that you should have a stable reference to data, which you can get by bringing it from outside the component, or by using useMemo.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@wq758511990
Comment options

Answer selected by wq758511990
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants