Skip to content

TypeError: destroy is not a function in useEffect caused by async/await #2

@dushyanth31

Description

@dushyanth31

Hello,
In Sidebar.js I am getting a error that is caused by useEffect.

In these lines:

useEffect(async () => {
try {
const response = await fetch(
${process.env.NEXT_PUBLIC_API_URL}/getchannels,
)
const data = await response.json()
setChannels(data)
router.push(?channel=${data[0].roomId}&name=${data[0].roomName})
} catch (error) {
console.error(error)
}
}, [])

@CleverProgrammer @kevikodes
Screenshot (8)

I'm all up to date. Still I am facing this issue.

Anyone please help me!

Thank You.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions