Jul 23, 2026
0
Level 7
Expose an empty function to overrride
Can I do something like this so I pass an empty function so I can override it from other places?
// useComposable.js
export default function useComposable() {
const doSomethingFunction = () => {}
const anotherFunction = async() => {
await doSomethingFunction();
console.log('do another thing after...')
}
return { doSomethingFunction }
}
// Parent
const { doSomethingFunction } = useComposable();
doSomethingFunction = () => {
console.log('overriden function, do something');
}
Please or to participate in this conversation.