反应更新后useReducer钩子需要3个参数

时间:2019-11-19 14:11:13

标签: reactjs typescript react-hooks

在将react和@ types / react版本更新为echo "{$row['slug']} : {$row['value']}"; //text : 120 , email : admin@admin.com, send : click 时遇到问题(如果我进行更多升级,则此问题仍然存在)。它说:String regex = "^[\\w][\\w\\.\\-]+";

代码:

16.9.0

我试图找到什么是第3个参数,但是我发现它只是可选的。也许有人遇到过同样的问题?

1 个答案:

答案 0 :(得分:0)

应在不使用State<D>, Action<D>类型变量的情况下进行定义:

const [state, dispatch] = React.useReducer(reducer, {
    loading: false,
    data: undefined,
    error: undefined
});
相关问题