Estoy haciendo algo mal, pero no sé qué! Me gustaría llamar a una función de una clase a otra, así es como lo hago
NotificaciónWeb3.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(); }Luego lo importo en mi 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> Pero tengo este error => TypeError: (0 , _utils_NotificationWeb3__WEBPACK_IMPORTED_MODULE_4__.handleSuccess) is not a function
¿Qué estoy haciendo mal?