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

1

23

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"
    ]
  }
}

Weatherford answered 16/5, 2022 at 19:44 Comment(0)
N
33

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.

Newfoundland answered 19/9, 2022 at 10:8 Comment(1)
I'm very glad that some else ran into this specific issue. your answer helped me a lotDrilling

© 2022 - 2024 — McMap. All rights reserved.