Open santhoshsvkmm opened 2 years ago
React.useEffect(()=>{ setOptions({ title: 'Custom Title', border: '4', width: "500px", height: "300px" }) },[show])
In this code you are re-rendering the page multiple times which is causing the multiple winbox. You do not need the useEffect Hook. Please follow the Documentation
The code samples are given below
import React from 'react'; import './App.css'; import WinboxReact from 'winbox-react' import 'winbox-react/dist/index.css' function App() { const [options,setOptions] = React.useState() const [show, setShow] = React.useState(true) React.useEffect(()=>{ setOptions({ title: 'Custom Title', border: '4', width: "500px", height: "300px" }) },[show]) return ( <> {show && ( <WinboxReact {...options}>
Lorem ipsum dolor sit amet
); }
export default App;
Screenshot