You need to sign in to do that
Don't have an account?

LWC: how to export/import module functions?
I am trying to export some Javascript code and import it in another module.
Following the documentation I did this:
mortgage.js:
The code stops working at the line I call getTxt();
No error in the console.
My console.log code is not even called.
Any suggestion?
Following the documentation I did this:
mortgage.js:
const getTxt = () => { console.log('yo getTxt'); return 'yoyoyo'; } export {getTxt};in another component: (it's NOT the full code, it's just to show that I don't use this.getTxt(). I call it directly like the example in the documentation
import getTxt from 'c/mortgage'; export default class another extends LightningElement { this.sectionDescription = getTxt(); }
The code stops working at the line I call getTxt();
No error in the console.
My console.log code is not even called.
Any suggestion?
This is working for me