Customize Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

No cookies to display.

Crear un proyecto con React y Next.js

Tiempo de lectura: 2 minutos

Hoy vamos a aprender cómo crear un proyecto React con Next.js y ejecutarlo.

Lo primero que vamos a hacer es crear un nuevo proyecto con este comando:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
npx create-next-app my_app
npx create-next-app my_app
npx create-next-app my_app

Ahora preguntará sobre la configuración.

Yo he elegido y recomiendo esta:

Usar TypeScript ya que nos va a permitir utilizar tipado en JavaScript, nos solucionará y agilizará el desarrollo. Usaremos ESLint para mejorar y controlar el código generado, importante debes instalar el plugin de VSCode ESLint.

Usamos CSS normal, creamos el directorio src y nos crea un App Router de ejemplo. Además, no vamos a utilizar alias.

Ahora debemos esperar mientras nos genera el proyecto.

Verificamos que nos crea el proyecto dentro de la carpeta que hemos indicado.

Los comandos importantes serán:

  • Instalar librerías nuevas:
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
npm install <plugin_name> --save
npm install <plugin_name> --save
npm install <plugin_name> --save
  • Ejecutar la web en desarrollo:
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
npm run dev
npm run dev
npm run dev
  • Generar build de producción (web para lanzar un con Apache o Nginx)
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
npm build
npm build
npm build
  • Instalar librerías que no tenemos en node_modules
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
npm run
npm run
npm run
0

Deja un comentario