JavaScript'te Export Kombinasyonları
Default export ve normal export'lar birlikte kullanılabilir:
export function func1() {
return '1'
}
export function func2() {
return '2'
}
export default function() {
return 'text';
};
Import işlemini gerçekleştirelim:
import test, {func1, func2} from './test.js';
Default fonksiyonun çalışmasını kontrol edelim:
let res = test();
console.log(res);
Diğer fonksiyonların çalışmasını kontrol edelim:
let res1 = func1();
let res2 = func2();
console.log(res1, res2);
Bir default fonksiyon ve birkaç tane daha fonksiyon export eden bir modül yapın.