简体   繁体   English

react 16.8.6 对应的测试库/反应版本是什么?

[英]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.我正在尝试制作一个 typescript 前端,但我不能使用react-dom/client导入,因为我已经缩小到我的测试库/反应版本与我的反应版本不对应的问题。 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.我将在下面附上我的package.json文件。

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

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 .查看react-testing-library 版本 12 的 package.json 的对等依赖项,我们可以说直到版本12.*react-testing-library支持react 18之前的任何react版本。 As of react-testing-library 13 , it requires react 18 .react-testing-library 13开始,它需要react 18

So to answer the question you can use react-testing-library 12.1.5 with react 16.8.6 .因此,要回答这个问题,您可以使用react-testing-library 12.1.5react 16.8.6

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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