我正在使用redux开发一个同构反应应用程序。我遇到了一些问题,将url参数传递到分派redux操作的函数中。
class SingleMovie extends Component {
componentDidMount(){
console.log(this.props.match.params.id); // i can access the id here
}
.....
}
function mapStateToProps(state){
return {movie:state.movie};
}
function loa
在使用React和Redux时,我遇到了这个有趣的观察。
import React, {Component} from 'react';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import {fetchBooks} from '../actions'
class Sample extends Component {
componentDidMount() {
/* Fetching f
我试图呈现从nodejs开始的数据,我使用redux进行状态管理。问题是,当我试图映射数据时,它会给我错误的解释。
未定义的TypeError:无法读取未定义的属性“映射”
这是我的代码/home.js
import React, {Component} from 'react';
import {connect} from 'react-redux';
import {getArticle} from '../../redux/actions/article';
class Home extends Component {
我已经创建了一个组件,并从userReducer获取数据并将其制作成道具,但是在呈现方法中,如果我对数据进行控制台(即用户数组),我可以在控制台中看到数据,但是当我将数据传递给一个函数并试图遍历数组时,我会得到以下错误。
未定义TypeError:无法读取未定义的属性“映射”
我不明白我犯了什么错误。
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {connect} from 'react-redux'
import * as