Add context to segments entrypoint
[MAILPOET-2389]
This commit is contained in:
committed by
Jack Kitterhing
parent
89d0362f13
commit
e5554a8227
@@ -4,11 +4,12 @@ import { HashRouter, Switch, Route } from 'react-router-dom';
|
|||||||
|
|
||||||
import SegmentList from 'segments/list.jsx';
|
import SegmentList from 'segments/list.jsx';
|
||||||
import SegmentForm from 'segments/form.jsx';
|
import SegmentForm from 'segments/form.jsx';
|
||||||
|
import { GlobalContext, useGlobalContextValue } from 'context/index.jsx';
|
||||||
|
|
||||||
const container = document.getElementById('segments_container');
|
const container = document.getElementById('segments_container');
|
||||||
|
|
||||||
if (container) {
|
const App = () => (
|
||||||
ReactDOM.render((
|
<GlobalContext.Provider value={useGlobalContextValue(window)}>
|
||||||
<HashRouter>
|
<HashRouter>
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route path="/new" component={SegmentForm} />
|
<Route path="/new" component={SegmentForm} />
|
||||||
@@ -16,5 +17,9 @@ if (container) {
|
|||||||
<Route path="*" component={SegmentList} />
|
<Route path="*" component={SegmentList} />
|
||||||
</Switch>
|
</Switch>
|
||||||
</HashRouter>
|
</HashRouter>
|
||||||
), container);
|
</GlobalContext.Provider>
|
||||||
|
);
|
||||||
|
|
||||||
|
if (container) {
|
||||||
|
ReactDOM.render(<App />, container);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user