Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React redux 在事件处理程序函数中传递值后,操作分派不起作用_React Redux - Fatal编程技术网

React redux 在事件处理程序函数中传递值后,操作分派不起作用

React redux 在事件处理程序函数中传递值后,操作分派不起作用,react-redux,React Redux,我正在学习redux和模仿老师的代码,我只是做了一些改变,但我不知道为什么它不能工作,我想尝试很多方法来调整它,但它太少太尝试,没有地方可以开始。下面是导致错误的代码,我猜是因为项目无法工作,而我写了一点。下面是几乎100%与丹阿布拉莫夫的版本https://embed.plnkr.co/github/eggheadio-projects/getting-started-with-redux/master/23-react-redux-extracting-container-component

我正在学习redux和模仿老师的代码,我只是做了一些改变,但我不知道为什么它不能工作,我想尝试很多方法来调整它,但它太少太尝试,没有地方可以开始。下面是导致错误的代码,我猜是因为项目无法工作,而我写了一点。下面是几乎100%与丹阿布拉莫夫的版本<代码>https://embed.plnkr.co/github/eggheadio-projects/getting-started-with-redux/master/23-react-redux-extracting-container-components-visibletodolist-addtodo?show=script,预览

const Deeplists = ({ store }) => {
  const [_, forceUpdate] = React.useReducer((x) => x + 1, 0);
  store.subscribe(forceUpdate);
  return (
    <Lists
      todos={deepertodos(
        store.getState().todos,
        store.getState().visibilityFilter
      )}
      onTodoClick={id=> store.dispatch({ type: "TOGGLE_TODO", id })}
    />
  );
};
const Deeplists=({store})=>{
const[\ux,forceUpdate]=React.useReducer((x)=>x+1,0);
store.subscribe(forceUpdate);
返回(
dispatch({type:“TOGGLE_TODO”,id})}
/>
);
};

这是我的项目链接:

您需要避免使用store.dispatch方法并替换为connect