Skip to main content
2 votes

Are there any good and modern approaches, to have variables that feel global (no need to pass them around explicitly), yet are local to an instance?

As the experts in this community point out, the solution is obvious: use OOP, enclose the state in objects and live a happy life: import {F} from './f'; ... // myLibrary/index.ts export class ...
Blue Nebula's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible