请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

model里面的reducers 里面的函数的泛型需要第二个参数,这里报错,可以指点一下,这里该怎以写吗?

图片描述

reducers 里面的函数的泛型需要第二个参数,这里报错,可以指点一下,这里该怎以写吗?

{
  "name": "app",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint . --ext .js,.jsx,.ts,.tsx"
  },
  "dependencies": {
    "@react-native-community/masked-view": "^0.1.10",
    "@react-navigation/native": "^5.2.4",
    "dva-core-ts": "^2.0.7",
    "react": "16.11.0",
    "react-native": "0.62.2",
    "react-native-config": "^1.0.0",
    "react-native-gesture-handler": "^1.6.1",
    "react-native-reanimated": "^1.8.0",
    "react-native-safe-area-context": "^0.7.3",
    "react-native-screens": "^2.7.0",
    "react-redux": "^7.2.0"
  },
  "devDependencies": {
    "@babel/core": "^7.6.2",
    "@babel/runtime": "^7.6.2",
    "@react-native-community/eslint-config": "^1.0.0",
    "@types/jest": "^24.0.24",
    "@types/react-native": "^0.62.0",
    "@types/react-redux": "^7.1.8",
    "@types/react-test-renderer": "16.9.2",
    "@typescript-eslint/eslint-plugin": "^2.27.0",
    "@typescript-eslint/parser": "^2.27.0",
    "babel-jest": "^24.9.0",
    "babel-plugin-module-resolver": "^4.0.0",
    "eslint": "^6.5.1",
    "jest": "^24.9.0",
    "metro-react-native-babel-preset": "^0.58.0",
    "prettier": "^2.0.4",
    "react-test-renderer": "16.11.0",
    "typescript": "^3.8.3"
  },
  "jest": {
    "preset": "react-native",
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js",
      "jsx",
      "json",
      "node"
    ]
  }
}


正在回答

1回答

我在讲课的时候并没有传入第二个类型,因为dva其实是有意淡化action的概念的,在redux中,会将每一个action都单独创建好,而在dva中,在需要发起action的时候再单独的创建action对象

0 回复 有任何疑惑可以回复我~
  • 提问者 火柴锅 #1
    但是不写第二个参数,又会报:(泛型类型“Reducer”需要 2 个类型参数。)  的错
    回复 有任何疑惑可以回复我~ 2020-05-07 21:55:52
  • 提问者 火柴锅 #2
    ok了
    回复 有任何疑惑可以回复我~ 2020-05-07 22:06:22
  • 慕姐0505225 回复 提问者 火柴锅 #3
    怎么解决的,麻烦告知谢谢
    回复 有任何疑惑可以回复我~ 2022-03-09 22:47:55
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信