Next.js Discord

Discord Forum

Global Variables in Next.js

Unanswered
Cordilleran Flycatcher posted this in #help-forum
Open in Discord
Cordilleran FlycatcherOP
Is there any way I can create a global variable in Next.js that I can access in all tsx/jsx files? Preferably without having to import anything (although I will be fine doing that if I have to).


If not, is there any way I can pass in props (two props with string values) using the Link component?

4 Replies

why wouldnt you want to import
what do you gain by not importing
@DirtyCajunRice | AppDir what do you gain by not importing
Cordilleran FlycatcherOP
idk, i guess its just kinda tedious to import the same thing in multiple files. If its unavoidable, I will just use imports
@Cordilleran Flycatcher idk, i guess its just kinda tedious to import the same thing in multiple files. If its unavoidable, I will just use imports
welcome to javascript lol. your IDE should automatically import it for you when you are typing it so its only tedious if you are coding in notepad