Skip to content

prevDep.length undefined Cannot read properties of undefined (reading 'length') #2513

Answered by dkkb
dkkb asked this question in Bug report
Discussion options

You must be logged in to vote

I think I find the root cause, it's bad to call Hooks inside conditions or loops.

useRssArticleByFeedId.ts:10 Warning: React has detected a change in the order of Hooks called by null. This will lead to bugs and errors if not fixed. For more information, read the Rules of Hooks: https://reactjs.org/link/rules-of-hooks

   Previous render            Next render
   ------------------------------------------------------
1. useRef                     useRef
2. useState                   useState
3. useEffect                  useEffect
4. useEffect                  useRef
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

From https://reactjs.org/link/rules-of-hooks:

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@dkkb
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by dkkb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants