Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
May 29, 2021 05:27 pm GMT

Migrating a notebook app from react to Next.js

I created a notebook app in react a few months ago. I wrote article about it.

Now I migrated this app to Next.js smoothly.
Here are the few steps that will guide you how i did this.

Step 1

Installed next in my project:

yarn add next

Step 2

Updated package.json with the following scripts:

"scripts": {  "dev": "next dev",  "build": "next build",  "start": "next start"}

Step 3

Created pages folder:

src/pages/_app.tsxsrc/pages/index.tsxsrc/pages/projects/index.tsx

Step 4

Migrated code:

from src/index.tsx and src/app.tsxto src/pages/index.tsx and src/pages/_app.tsx

Note: I didn't copy paste code here.

Step 5

Deleted these files:

src/index.tsxsrc/app.tsx

Final step

  • Used next/router.
  • Replaced chakra links and react-router-dom links with next/link in different files.

App

Demo Link: Notebook
GitHub Repo: Repo


Original Link: https://dev.to/m_ahmad/migrating-a-notebook-app-from-react-to-next-js-3ljn

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To