如何从 Redux 商店中移除 Board-React js, redux [英] How to Remove Board from Redux store-React js, redux

查看:41
本文介绍了如何从 Redux 商店中移除 Board-React js, redux的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这里,我通过单击按钮创建新板,一旦我进入板页面,我就可以选择创建新的小部件

Here i am creating new board by clicking on button, Once i enter board page i have option of creating new widgets

如果用户没有创建新的小部件并点击 backtoboards 按钮,则不应创建板

If user is not creating new widget and click backtoboards button , boards should not be created

这里正在创建板子,我无需保存就可以看到板子,

here board is getting created,i am able to see the boards with out saving,

如果我刷新页面看不到.

If i refresh the page board is not seen.

如果点击返回板按钮,我可以得到一些关于如何防止创建板的建议

can i get some suggestion on how to prevent creating board if back to board button is clicked

点击返回板下面的功能将被调用

click on back to board below function will be called

回到董事会

manageShowBoard = (selectedBoard) => {
this.setState({ selectedBoard });
};

推荐答案

首先,你要传递selectedStoryboard 作为动作的payload,然后简单地:

First of all, you have to pass the selectedStoryboard as the payload of the action, then simply:

case types.REMOVE_STORYBOARD:
{
  const boardToRemove = ... // get from action payload
  return {
     ...state,
    boardList: state.boardList.filter(board => board !== boardToRemove);
  };
}

这篇关于如何从 Redux 商店中移除 Board-React js, redux的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆