skip to Main Content

Html – how to prevent re-render when handle onclick

let inner=useRef(); let inner_exit=useRef(); useEffect(()=>{ inner.current=document.querySelectorAll('.inner'); inner_exit.current=document.querySelectorAll('.exit'); inner_exit.current?.[0].addEventListener("click",toogleInner); inner.current?.[0].addEventListener("click",(e)=>{ if(e.target === e.currentTarget) toogleInner(); }); },) const toogleInner = ()=>{ inner.current?.[0].classList.toggle('hide'); }; return ( <div className='inner'> <div className='contentSign'> <div className='form'> <h2>Đăng nhập</h2> <span className='exit'>X</span> </div> </div> ) }; I want when…

VIEW QUESTION

Reactjs – Why when I set property in a component it starts throwing hydration exceptions Next js

"use client"; const Component = ({ className }) => { const [open, setOpen] = useState(false); const [showNewOrganizationDialog, setShowNewOrganizationDialog] = useState(false); return ( <Dialog open={showNewOrganizationDialog} onOpenChange={setShowNewOrganizationDialog} > <Popover open={open} onOpenChange={setOpen}> <PopoverTrigger asChild>...</PopoverTrigger> <PopoverContent className="w-[200px] p-0">...</PopoverContent> </Popover> <DialogContent>...</DialogContent> </Dialog> ); }; This…

VIEW QUESTION
Back To Top
Search