safak / youtube2022

Season 2 on Lama Dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting undefined error in chats.jsx

yatharthdwivedi opened this issue · comments

Getting undefined error in chats.jsx

react-dom.development.js:26740 Uncaught TypeError: Cannot convert undefined or null to object
at Function.entries ()
at Chats (Chats.jsx:34:1)
at renderWithHooks (react-dom.development.js:16141:1)
at updateFunctionComponent (react-dom.development.js:20313:1)
at beginWork (react-dom.development.js:22356:1)
at beginWork$1 (react-dom.development.js:27219:1)
at performUnitOfWork (react-dom.development.js:26392:1)
at workLoopSync (react-dom.development.js:26303:1)
at renderRootSync (react-dom.development.js:26271:1)
at recoverFromConcurrentError (react-dom.development.js:25689:1)

im getting a similar error as well

Same error

@yatharthdwivedi, simply change the code

Object.entries(chats) to Object.entries(chats || {})

at your line 34 and the error will be gone