Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

226
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!