0

After trying to get several more commonly suggested methods of getting data from one Vue page to another and failing, I found (window as any).storagename = datatostore; to be an incredibly easy to use method to store and then retrieve information with retrievedata = (window as any).storagename from anywhere in my project to anywhere.

I am wondering however if there are downsides or potential issues I should be aware of? Since this method is never the first option mentioned, I wonder if there is a reason it is not used as much.

Zyzyx
  • 492
  • 4
  • 18
  • 1
    Possible duplicate of https://stackoverflow.com/questions/10525582/why-are-global-variables-considered-bad-practice – Estus Flask Jan 26 '22 at 12:53
  • 1
    Also see https://softwareengineering.stackexchange.com/questions/148108/why-is-global-state-so-evil . Global variables were previously used in JS due to language limitations. There's no excuse for doing this in modular environment, unless you know it's the right case for them. – Estus Flask Jan 26 '22 at 12:55

0 Answers0