简体   繁体   中英

Conversion from an create-react-app (CRA) to CRA + Next.Js app

I have a SPA made with create-react-app and it contains a forum where logged in users can post along with other features. The forum is simply a component within the app currently.

For SEO purposes I want to make the forum public and like Stack Overflow use dynamic routing for those posts and it should be viewable to anyone searching on Google without having to login. The user has greater abilities when logged in.

So I assume I have to implement server-side rendering on the forum using Next.js .

The problem is the rest of the code( React + Redux implementation ) needs no changes and converting it to Next.js would be unnecessary. Is there a way to implement the forum within the CRA?

Yes there is. The official Next.js docs actually offers solutions on how to incrementally adopt Next.js.

There are two flavors:

  • subpaths
  • rewrites

Their documentation explains both in detail: https://nextjs.org/docs/migrating/incremental-adoption

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM