Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

120
Vistas
How to show the app version and last updated datetime in a React or Next app?

I build my React/Next app using Github Actions. In the workflow, I have set up an automated system to determine the next release version. It creates a .version file containing the version and a .last-updated file containing the build date and time.

Now how do I use these files in my app and show the required information or is there a better way to do such a thing?

I want something like Notion:

enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Okay. So I figured it out.

  1. In next.config.js, add the following config:
const fs = require("fs");

const version = fs.readFileSync("./.version", "utf8");
const lastUpdatedAt = fs.readFileSync("./.last-updated", "utf8");

module.exports = {
  ...
  env: {
    NEXT_PUBLIC_PACKAGE_VERSION: version,
    NEXT_PUBLIC_LAST_UPDATED_AT: lastUpdatedAt,
  },
};

Note: For public environment variables, prefix them with NEXT_PUBLIC_.

  1. Then in your JSX templates, use like this
<p>Version: {process.env.NEXT_PUBLIC_PACKAGE_VERSION || "-"}</p>
<p>Last Updated At: {process.env.NEXT_PUBLIC_LAST_UPDATED_AT || "-"}</p>
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda