DEV Community

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

Posted on • Edited on

7 6

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

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (1)

Collapse
 
sm0ke profile image
Sm0ke

Looks nice

Billboard image

Deploy and scale your apps on AWS and GCP with a world class developer experience

Coherence makes it easy to set up and maintain cloud infrastructure. Harness the extensibility, compliance and cost efficiency of the cloud.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay