📜  set popper click outside - 任何代码示例

📅  最后修改于: 2022-03-11 15:00:12.789000             🧑  作者: Mango

代码示例1
//dependencies
const { render } = ReactDOM,
      { useState } = React,
      { Popper, Button, Paper, ClickAwayListener } = MaterialUI
      
//custom popper
const MyPopper = ({isOpen,clickAwayHandler}) => (
    
        
          There goes my custom popper
        
     
)

//main page
const MainPage = () => {
  const [isOpen, setIsOpen] = useState(true),
        clickAwayHandler = () => setIsOpen(false),
        clickHandler = () => setIsOpen(true)
  return (
    
{ isOpen && }
) } //render render ( , document.getElementById('root') )