toggleGot不是函数

时间:2019-04-17 16:05:22

标签: javascript react-native

当我按下TouchableOpacity时出现错误,“ toggleGot不是函数。 (在“ toggleGot(todo.id)”中,“ toggleGot”未定义) 错误

当onPress时,它应该在正确和错误之间切换.got:。

我在查找问题时遇到了麻烦,我仔细检查了代码的其他区域,一切似乎井井有条。我想知道是否与两次传递todo.id有关。我可能应该从中取出两个部分并导入吗?想了解的不只是解决。

我仔细检查了所有内容,寻找拼写错误,语法错误,忘记了导入。我不能嗅出它。 我只是想知道错误是否在我期望的范围内。。我在其他地方都在寻找语法错误。我只是在想也许这里有一条规则我想把我所缺少的这种冲突束缚住。

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">


<input type="hidden" name="item_name" value="<?php echo the_title(); ?> ">

<input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="hosted_button_id" value="xxxxxx" />
<input  id="btnSubmit" class="btn" type="submit" value="DONA CON PAYPAL"  type="image" border="0" name="submit" title="PayPal - The safer, easier way to pay online!" alt="Donate with PayPal button"  disabled/>
img alt="" border="0" src="https://www.paypal.com/it_IT/i/scr/pixel.gif" width="1" height="1" />
</form>

预期结果:todo.got:在true和false之间切换 实际结果是上述错误。

1 个答案:

答案 0 :(得分:0)

我想回答自己的机会(愚蠢的错误) (这是自学徽章的机会,这是一线希望)

您必须分派动作。 Reducer会捕获动作和状态,但是需要通过调度来使其处于运动状态。

将其添加到我的容器中。和工作。

const mapDispatchToProps = dispatch => ({
    toggleTodo: id => dispatch( toggleTodo(id) ),
    toggleGot: id => dispatch( toggleGot(id) ),
})