Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the corresponding testing-library/react versions for react 16.8.6?

I'm trying to make a typescript frontend but I can't use the react-dom/client import because of an issue that I've narrowed down to my testing-library/react version not corresponding with my react version. I've tried multiple downgraded versions but can't seem to get it to work.

Is there any solutions to this? I'll attach my package.json file below.

{
  "name": "balls",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@material-ui/core": "^4.12.4",
    "@material-ui/icons": "^4.11.3",
    "@testing-library/jest-dom": "^5.16.4",
    "@testing-library/react": "12.1.5",
    "@testing-library/user-event": "^13.5.0",
    "@types/jest": "^27.5.1",
    "@types/node": "^16.11.35",
    "@types/react": "^16.8.6",
    "@types/react-dom": "^16.8.6",
    "@vercel/node": "^1.15.2",
    "axios": "^0.27.2",
    "react": "^16.8.6",
    "react-dom": "^16.8.6",
    "react-scripts": "5.0.1",
    "typescript": "^4.6.4",
    "vercel": "^24.2.3",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

like image 610
yvirdi Avatar asked Sep 12 '25 06:09

yvirdi


1 Answers

Looking at the peer dependencies of package.json of the version 12 of react-testing-library we can say that until version 12.*, react-testing-library supports any react version before react 18. As of react-testing-library 13, it requires react 18.

So to answer the question, at the time of writing, you can use react-testing-library 12.1.5 with react 16.8.6.

like image 63
Soufiane Ghzal Avatar answered Sep 14 '25 22:09

Soufiane Ghzal