Buka Modal Saat Mengklik Pilih Opsi di React
import * as React from 'react';
export class Demo extends React.Component<{}, {}> {
state = {
options: [
{ text: 'doNothing', value: 'doNothing' },
{ text: 'openModal', value: 'openModal' }
],
open: false
};
onClose = () => this.setState({open: false});
onChange = (selected) => {
// if the correct one is selected then...
// this.setState({open: true});
}
render() {
return (
<div>
<Dropdown
fluid
selection
options={this.options}
onChange={this.onChange}
defaultValue={this.options[0].value} />
<Modal open={this.state.open} onClose={this.onClose}>
<Modal.Header>Select a Photo</Modal.Header>
<Modal.Content image>
<Modal.Description>
<p>Some contents.</p>
</Modal.Description>
</Modal.Content>
</Modal>
</div>
)
}
}
Busy Bee