我得到了错误:
Actions may not have an undefined "type"属性
但我肯定我给它下了定义并拼写正确。
应用程序:
import React, {Component} from 'react';
import { createStore, applyMiddleware, combineReducers } from 'redux';
import { Provider } from 'react-redux';
import { AsyncStorage } from 'react-na
假设我使用dispatch()分派一个动作,我知道reducer()被调用,其中有an action object and current state as parameters。我想知道什么叫减速器功能?在减速器函数和调度函数之前调用哪些函数?还原器函数返回新的状态后,在此之后调用哪些函数?这个新国家将走向何方?在还原器函数返回新状态后,usestate()和useselector()是否也返回一些内容?
我正在调度一个在数据库中创建数据的操作,并在reducer中添加该数据。我的问题是,我如何才能获得刚刚添加的数据的id?我想向用户显示id。 //on button click this method dispatch a action
create(){
this.store.dispatch(new fromStore.CreateData({test:"hello"}));
this.idOfCreatedData = ""; //dont know how
//normally i retrieve data from store through
我有以下代码,我想知道这是否会导致堆栈溢出。我不熟悉setTimeout函数的处理方式及其后果。
function func1() {
// some logic for the dynamicTimeout
setTimeout("func2()", dynamicTimeout);
}
function func2() {
// do something
func1();
}