Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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>
    )
  }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: open new window in java script 
Javascript :: address format 
Javascript :: make table responsive react-bootstrap-table2 
Javascript :: react native select option 
Javascript :: mongoose callback in save function 
Javascript :: next js get gurrent page params 
Javascript :: js how to find max value in an array 
Javascript :: javascript set element class 
Javascript :: 100 day javascript challenge 
Javascript :: methods javascript 
Javascript :: 10 javascript interview questions 
Javascript :: are you sure you want to close this window javascript 
Javascript :: get number of digits in a number 
Javascript :: js array clear 
Javascript :: How to replace an array vue.js 
Javascript :: javascript isempty 
Javascript :: factors of a number 
Javascript :: get element of selection javascript 
Javascript :: onomonrieah 
Javascript :: Play and Pause media for HTML5 using JS/Javascript 
Javascript :: mongoose limit skip 
Javascript :: javascript async await not waiting 
Javascript :: localhost:3000 ad is not working with outlook angular 8 
Javascript :: Algorithm used by strapi for password 
Javascript :: javascript alert html 
Javascript :: nodejs add to array 
Javascript :: lodash get first element of array 
Javascript :: react native azure 
Javascript :: javascaript 
Javascript :: angular http post example 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =