Code: this is my index.js file
index.js
import { Provider } from "react-redux";
import { createStore } from 'redux';
import App from './app';
import reducer from './store/reducer';
const store = createStore(reducer);
console.log("Store ..."+store);
console.log(Provider);
ReactDOM.render((
<Provider store={store}>
<App/>
</Provider>
), document.getElementById('root'));
Code: this is my reducer.js file
reducer.js
import * as actionTypes from './actions';
const initialState = {
assistants:[],
fetchInProgress:true
}
const reducer = (state = initialState, action) =>{
return state;
};
export default reducer;
Code: this is my app.js file app.js
class App extends Component{
render(){
return(
<HashRouter>
<Switch>
<Route exact path="/login" name="Login Page" component={Login}/>
<Route exact path="/register" name="Register Page" component=
{Register}/>
<Route exact path="/404" name="Page 404" component={Page404}/>
<Route exact path="/500" name="Page 500" component={Page500}/>
<Route path="/" name="Home" component={Full}/>
</Switch>
</HashRouter>
);
}
}
export default App;
Error: Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Check the render method of Provider
.
please refer both images for error. i am getting error as please check your provider component render method but this is not in my hand to change provider render method. because its imported class from redux so, please help me with this problem i am facing this from last two days not able to solve.
app.js
exporting correctly the component you're trying to render inside theProvider
? – Rishi