Si 12
Si 12

Reputation: 111

Can I migrate a 'page router' application to 'app router' for existing T3 Stack (TypeScript, Tailwind, trpc)

Recently I've been working on a project. The project environment has been set up using the t3 stack using Next.js 'page router'. But I want to use 'app router' in the existing project. Note: The next.js version is: 13.4.19. Can I do it? If it is possible then how can I do that?

I am trying to migrate the existing 'page router' project into 'app router'.

Upvotes: 1

Views: 488

Answers (1)

Enjoy Coding.
Enjoy Coding.

Reputation: 643

I think this is possible.

First of all, you will need to install like this:

npm install next/app next/router

Then update your _app.js file, like this:

import { useRouter } from 'next/router'; 
import { useEffect } from 'react'; 
import MyApp from 'next/app'; 
function App({ Component, pageProps }) { 
   const router = useRouter(); 
} 
export default App;

Upvotes: -1

Related Questions