mercredi 22 avril 2020

Should/do I have to export returning class returned by another exported class in Javascript ES6?

Consider the following module:

export class Bar {

    generateFoo() {
        return new Foo(1);
    }

}

class Foo {

    constructor(fooValue) {
        this.fooValue = fooValue;
    }

    doFoo() { console.log(this.fooValue); }

}

Should I export Foo too in any situation? Why/Why not?

Aucun commentaire:

Enregistrer un commentaire