Error ts(80007) on await
Unanswered
Cape lion posted this in #help-forum
Cape lionOP
I'm getting a minor error ts(80007) on my await statement.
My function is within a button component and I am handling the routing for when the user clicks the button. The weird thing is I'm using javascript not typescript. Also, I implemented my async and await properly so I'm not sure why I'm getting an error on await here.
const handleOnClick = async () => {
If (route) {
try {
await router.push(route)
}
catch {
...
My function is within a button component and I am handling the routing for when the user clicks the button. The weird thing is I'm using javascript not typescript. Also, I implemented my async and await properly so I'm not sure why I'm getting an error on await here.
const handleOnClick = async () => {
If (route) {
try {
await router.push(route)
}
catch {
...
1 Reply
@Cape lion I'm getting a minor error ts(80007) on my await statement.
My function is within a button component and I am handling the routing for when the user clicks the button. The weird thing is I'm using javascript not typescript. Also, I implemented my async and await properly so I'm not sure why I'm getting an error on await here.
const handleOnClick = async () => {
If (route) {
try {
await router.push(route)
}
catch {
...
You shouldn't need to
https://nextjs.org/docs/app/api-reference/functions/use-router
await for router.push()https://nextjs.org/docs/app/api-reference/functions/use-router