Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.
Структура проекта:
App.js
import React, { Component } from 'react'
import './App.css';
import Box from '@material-ui/core/Box';
import Grid from '@material-ui/core/Grid';
import Data from './data/data';
import TextField from '@material-ui/core/TextField';
import Button from '@material-ui/core/Button';
import { connect } from 'react-redux'
class App extends Component {
render() {
const { firstData, secondData } = this.props;
return (
<Box className="App">
<h1 className="title">{firstData}{secondData}</h1>
</Box>
)
};
}
const mapStateToProps = store => {
return {
firstData: store.firstData,
secondData: store.secondData,
}
}
export default connect(mapStateToProps)(App)
store/store.js
import {combineReducers, createStore} from 'redux';
import reducer from '../reducers'
export default createStore(combineReducers(reducer))
reducers/index.js
let firstData = {
data: 'Fake'
};
let secondData = {
data: 'Persons'
};
export default {firstData, secondData};