How to install next-js with react 17?

Viewed 3046

How I can install next.js with React 17? When I type: npx create-next-app --ts, npx installed Next with React 18, but I can't use React 18, because Stripe not working at the moment with R18 (https://www.npmjs.com/package/stripe).

2 Answers

If you've already created the project:

remove new versions:

npm uninstall next react react-dom @types/react @types/react-dom 

install old versions:

npm install next@12.1.2 react@17.0.2 react-dom@17.0.2
npm install -D @types/react@17.0.2 @types/react-dom@17.0.2

You'd need to use an older version of Next JS.

The latest one I can see with React 17 is 12.1.2, so you can start your project with the following:

npx create-next-app@12.1.2

You can check the release change logs for Next JS here: https://github.com/vercel/next.js/releases

Related