Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

display content in a modal react

import React, { useState } from "react";
import "./styles.css";

import Modal from "react-modal";

Modal.setAppElement("#root");

export default function App() {
  const [isOpen, setIsOpen] = useState(false);

  function toggleModal() {
    setIsOpen(!isOpen);
  }

  return (
    <div className="App">
      <button onClick={toggleModal}>Open modal</button>

      <Modal
        isOpen={isOpen}
        onRequestClose={toggleModal}
        contentLabel="My dialog"
      >
        <div>My modal dialog.</div>
        <button onClick={toggleModal}>Close modal</button>
      </Modal>
    </div>
  );
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: linear gradient css react js 
Javascript :: adding attribute in jquery 
Javascript :: JavaScript Use clearInterval() Method 
Javascript :: javascript canvas beziercurveto 
Javascript :: react app js 
Javascript :: date add hours javascript 
Javascript :: include other js files in a js file 
Javascript :: angular http loader 
Javascript :: import svg react 
Javascript :: embed video by javascript 
Javascript :: urlencoded limit express 
Javascript :: disable button in jsx 
Javascript :: how to remove last element in js 
Javascript :: json placholder 
Javascript :: input type styled components 
Javascript :: view my password jquery 
Javascript :: jest expect not contain 
Javascript :: substring 
Javascript :: jsx classname multiple 
Javascript :: javascript how to sort alphabetically 
Javascript :: create a binary tree 
Javascript :: fonction fleche javascript 
Javascript :: set timeout for loop 
Javascript :: button not exist js 
Javascript :: on refresh react url not working or 404 page not showing react 
Javascript :: get the most recent records in mongoose 
Javascript :: Update multiple documents by id set. Mongoose 
Javascript :: capacitor.ionicframework.com to apk 
Javascript :: javascript multidimensional array foreach 
Javascript :: react native share image 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =