Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

372
Visualizações
Whats the best way to define global variables for common fields in Next.js?

For my Next.js Web-App, I want to define some sort of global variables for common values, which I then can reuse all over the application, in order to have a single location where common variables are defined, save writing and also make future modifications much easier (as the value only has to be changed at one place).

Main use case: Text Fields, e.g.

COMPANY_NAME = "XYZ Ltd."
COMPANY_SLOGAN = "We love stack overflow."
COMPANY_MAIL = "contact@xyz.io"

Everywhere I searched, I read that in Next.js env Variables could be used (e.g. with process.env.COMPANY_NAME), but is env really the correct place for defining simple text fields as per my main use case? I'm also aware that props could be used which are then passed on to all components, but if thats the best-practice, where's the correct place to define them?

To take it one step further, also language localization would be a possible use case for these global variables (e.g. all values for EN and DE). Can this be solved in a similar way?

Thank you for your expertise.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda