TypeError: Cannot read properties of undefined (reading 'indexOf') [Firebase V9 Error Specifically]

Viewed 68

Bellow is my code that contains the snippet of the source (the error starts from return statement )

    const [user, loading, error] = useAuthState(auth);
    const [channelInfo ,setChannelInfo] = useRecoilState(channelState)
    const [input,setInput] = useState('')
    const ChatRef = useRef()
    const [chats , setChats] = useState([])
    const [chan ,setCHan] = useRecoilState(channelId)
    const Router = useRouter() 
    
    useEffect(()=>{
        return onSnapshot(collection(db,'channels',Router?.query?.id,'messages'),(snapshot)=>{
            setChats(snapshot?.docs)
        })
    },[db])



0 Answers
Related