“我使用redux调用了外部react,当我试图使用map函数时,存储中装载了来自API.But的数据”无法读取未定义的属性'map‘错误。
{this.props.carDetails.array.map(([key,value])=>[key,value])}
carDetails is loaded with following dat
open_cars: Array(2)
0: {carid: 1, title: “bmw”} 1: {carid:2,title:”audi”}"
Here is my class
import
编辑:也许我不应该在同一个应用程序中组合React钩子和mapStateToProps,而是使用Redux钩子(useSelector等)?
在我的React应用程序中,我在Redux中有一个“好友”数据数组。我在我的一个组件中使用useEffect,以便在每次数据更改时将其存储到浏览器localStorage中。
// 'friends' is an array from Redux store,
// storeManyFriends is an action creator that will store to Redux
const {friends, storeM
我把我的项目从React转移到React,Redux和redux堆栈,出现了一个错误。在转移到这个堆栈之前,一切都正常工作。。我试着在三天内修好它,但没成功。
我的index.js:
import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import store from "./store/date";
import {BrowserRouter} from "react-router-dom";
imp
我试图通过一个对象数组来呈现一个redux状态,但是我得到的不是一个函数。我可以console.log我的道具看它正在接收,但它似乎是试图通过它之前道具已被传递到组件。正如您所看到的,我也尝试过使用&&方法,就像其他人所建议的那样,但我得到的只是:
TypeError: myItems.map is not a function
这是我的代码
import React, {Component} from 'react';
import { connect } from 'react-redux';
class RandomComponent e
我用的是最新的反应节。我想获得当前状态屏幕快照的状态,但是我得到了一个错误,即类型是空对象,还原器是“从不”,在尝试useSelector时我根本无法检测到状态,我也把存储放到了提供者中。
错误
TS2322: Type 'EmptyObject & { session: never; }' is not assignable to type 'ReactNode'.
index.js
root.render(
<Provider store={store}>
<BrowserRouter>
<App
我可以从网站扩展中看到我想要的redux状态的所有数据,然而,当我想把它拉出来用在我的组件中时,它说this.props.rules是未定义的: 下面是create-store.js: import {createStore, applyMiddleware} from 'redux';
import mainReducer from './reducers/main-reducer';
import {composeWithDevTools} from 'redux-devtools-extension';
import thunk from