Skip to content

react query select causing useEffect infinite loop #3769

Answered by TkDodo
ranshine asked this question in General
Discussion options

You must be logged in to vote

inline select functions run on every render. you can extract or memoize them if you want. see:

https://tkdodo.eu/blog/react-query-data-transformations#3-using-the-select-option

also, you don't need a useEffect to derive state - that is very likely an antipattern. see:

https://tkdodo.eu/blog/dont-over-use-state

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@ranshine
Comment options

@TkDodo
Comment options

@ranshine
Comment options

@ranshine
Comment options

@TkDodo
Comment options

Answer selected by ranshine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants