Utilizei o ReactReduxContext.Consumer para resolver o problema de acesso ao store global. https://react-redux.js.org/api/provider
index.js
ReactDOM.render(
(
<Provider store={store}>
<Router history>
<div>
<Switch>
<Route exact path="/" component={Login}/>
<Route path="/timeline" render={verificaAutenticacao} />
<Route path="/logout" component={Logout} />
</Switch>
</div>
</Router>
</Provider>
)
, document.getElementById('root'));
App.js
import React, { Component } from 'react';
import Header from './componentes/Header';
import Timeline from './componentes/Timeline';
import { ReactReduxContext } from 'react-redux';
class App extends Component {
render(){
return (
<ReactReduxContext.Consumer>
{({ store }) => {
return (
<div id="root">
<div className="main">
<Header store={store}></Header>
<Timeline store={store}></Timeline>
</div>
</div>
)
}}
</ReactReduxContext.Consumer>
);
}
}
export default App;
Foi utilizada