import React, { PropTypes } from 'react';
import Dialog from 'material-ui/Dialog';
export default class simpleModal extends React.Component {
constructor(props){
super(props)
}
handlePrimaryButton = () => {
this.props.router.push('/some/path');
}
render(){
return(
<Dialog
actions={<RaisedButton
label="OK"
primary={true}
onTouchTap={this.handlePrimaryButton}
/>}
modal={false}
open={this.props.open}
>
{this.props.msg}
</Dialog>
)
}
}
I created a wrapper using material-ui Dialog component but I can't open it. In another component I have this in my render method:
<simpleModal open={this.state.openSimpleModal} />
I then change the state of openSimpleModal using this.setState({openSimpleModal: true})
I don't see the modal being open. Is there anything missing in my above code? I manage to use Dialog component of material-ui directly but not with a wrapper.
Note: No error in chrome console at all.
Please submit support requests and questions to StackOverflow using the tag material-ui. StackOverflow is better suited for this kind of support. The issue tracker is for bug reports and feature discussions. See also our CONTRIBUTING guidelines.
Actually, you already did http://stackoverflow.com/questions/43589054/used-wrapper-but-modal-not-opening.
if you feel you're missing something if you installed the latest react version and it is not working, ensure your react-dom version matches up with the latest react version.
For example install react 16.4.0 and react-dom 16.4.0 . it worked for me
Thanks @philsam . You saved my day!
Most helpful comment
if you feel you're missing something if you installed the latest react version and it is not working, ensure your
react-domversion matches up with the latest react version.For example install
react 16.4.0andreact-dom 16.4.0. it worked for me