I am trying to open a Dialog
box by a button click.
When I am clicking the button the Dialog
first of all is not opened and I am getting Error : >
All the material-ui component must be rendered inside
tag, so we need to wrap topmost component (or at least any parent component) in material-ui's MuiThemeProvider
component.
Issue is, your Dialog is outside of the MuiThemeProvider
tag, put dialog also inside it, it should work.
Write it like this:
}
/>
Suggestion:
If you are using material ui elements in many components, then no need to put MuiThemeProvider tag on each page instead of that you can put in you homepage or better to put in index.js page, where we used to define all the routes, like this:
const muiThemebtn = getMuiTheme()
ReactDOM.render((
), document.getElementById('app'));