Add context to segments entrypoint

[MAILPOET-2389]
This commit is contained in:
Amine Ben hammou
2019-11-27 13:48:49 +01:00
committed by Jack Kitterhing
parent 89d0362f13
commit e5554a8227

View File

@@ -4,11 +4,12 @@ import { HashRouter, Switch, Route } from 'react-router-dom';
import SegmentList from 'segments/list.jsx';
import SegmentForm from 'segments/form.jsx';
import { GlobalContext, useGlobalContextValue } from 'context/index.jsx';
const container = document.getElementById('segments_container');
if (container) {
ReactDOM.render((
const App = () => (
<GlobalContext.Provider value={useGlobalContextValue(window)}>
<HashRouter>
<Switch>
<Route path="/new" component={SegmentForm} />
@@ -16,5 +17,9 @@ if (container) {
<Route path="*" component={SegmentList} />
</Switch>
</HashRouter>
), container);
</GlobalContext.Provider>
);
if (container) {
ReactDOM.render(<App />, container);
}