DEV Community

Cover image for Migrating a notebook app from react to Next.js
Muhammad  Ahmad
Muhammad Ahmad

Posted on • Updated on

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
Enter fullscreen mode Exit fullscreen mode

Step 2

Updated package.json with the following scripts:

"scripts": {
  "dev": "next dev",
  "build": "next build",
  "start": "next start"
}
Enter fullscreen mode Exit fullscreen mode

Step 3

Created pages folder:

src/pages/_app.tsx
src/pages/index.tsx
src/pages/projects/index.tsx
Enter fullscreen mode Exit fullscreen mode

Step 4

Migrated code:

from src/index.tsx and src/app.tsx
to src/pages/index.tsx and src/pages/_app.tsx
Enter fullscreen mode Exit fullscreen mode

Note: I didn't copy paste code here.

Step 5

Deleted these files:

src/index.tsx
src/app.tsx
Enter fullscreen mode Exit fullscreen mode

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

Top comments (1)

Collapse
 
sm0ke profile image
Sm0ke

Looks nice