Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

232
Visualizações
Calling a function from a class to another generate an error in Next.js

I'm doing something wrong but I don't figure out what ! I would like to call a function from a class to another, This is how I do

NotificationWeb3.js :

import {useNotification} from "web3uikit";

export default function NotificationWeb3()  {
    const dispatch = useNotification();

    const handleSuccess = async function (tx, type, message, title, icon) {
        await  handleNotification(tx, type, message, title, icon)
    }

    const handleNotification = function (type, message, title, icon) {
        dispatch({
            type:type,
            message: message,
            title:title,
            position:"topR",
            icon:icon,
        })
    }

    return handleSuccess();
}

Then I import it in my WorkflowStatus.js :

import { handleSuccess } from "./utils/NotificationWeb3";

<button
                onClick={async () =>
                    await voting({
                        onSuccess: (value) => {
                            handleSuccess('info', 'coucou', 'ola', 'bell')
                            setWorkflowStatus(value)
                            console.log(value)
                        },
                        onError: (err) => {
                            console.log(err)
                        }
                    })
                }
            >
                Change status
            </button>

But I've got this error => TypeError: (0 , _utils_NotificationWeb3__WEBPACK_IMPORTED_MODULE_4__.handleSuccess) is not a function

What I'm doing wrong ?

about 4 years ago · Santiago Gelvez
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda