I implemented a well working view layer in React JS where everything still operates on dummy data.
Now I need a modal popup that can be triggered from a lot of different components. According to this thread this could be nicely implemented with Redux, so I tried that.
After having to change my Router and reading countless docs I came up with
const Root = ({store}) => (
<Provider store={store}>
<Router history={browserHistory}>
<Route path="/" component={...}/>
<Popup visible={store.getState().taskEditPopup.open}>
<...>
</Popup>
</Router>
</Provider>
)
ReactDOM.render(
<Root store={store}/>,
document.getElementById('react')
)
When the Popup
is a child of Provider
, it gives an error and as a child of Router it does not appear in the DOM.
So where to put this global modal? Is there a standard way to solve this?