How to access a specific element in an array and change its value to the opposite? In order not to duplicate the code, I want to make the display of modal windows in this way
const [visiblePopup, setVisiblePopup] = useState([
{
modalUsers: false,
modalDetails: false,
modalWarning: false,
modalUpdate: false
}
]);
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>