Horje
open modal on clicking select option in react Code Example
open modal on clicking select option in 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>
    )
  }
}




Javascript

Related
react arrays Code Example react arrays Code Example
react map Code Example react map Code Example
javascript test if undefined Code Example javascript test if undefined Code Example
react create array Code Example react create array Code Example
inherit javascript Code Example inherit javascript Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7