Modular projects (qwik qestion)

quick general question about js projects (i tried googlin’ it’s just i don’t know which of the many answers is more common/good practice advice).

i found myself writing very modular code but needing to share changeable variables across modules/files.

suddenly realised i never did it this way before and learnt modules only to discover they are for constants only.
is using localStorage good practice? or is keeping the same html file whilst showing/hiding <div>'s better (then using getElement..)?

localStorage seems easy enough but not sure if there are drawbacks or limits.