I'm getting 'React.Children.only expected to receive a single React element child.' from the following code.
I have created a new react app using create-react-app and installed redux and react-redux, and created a simple reducer and creating store with that.
import React from "react";
import ReactDOM from "react-dom";
import { createStore, combineReducers } from "redux";
import { Provider } from "react-redux";
import logo from './logo.svg';
import './App.css';
class App extends React.Component {
render() {
return (
<div className="App">
<div className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h2>Welcome to React</h2>
</div>
<p className="App-intro">
To get started, edit <code>src/App.js</code> and save to reload.
</p>
</div>
);
}
}
function productReducer(state = [], action) {
return state;
}
const store = createStore(
productReducer
);
ReactDOM.render((<Provider store={store}><App /> </Provider>), document.getElementById('root'));