It opens automatically based on your isOpen which you have set to loginModal. When that is set to true, the modal will be opened. You should use a variable for that.
const [showModal, setShowModal] = useState(true);
...
return(
<IonModal isOpen={showModal} cssClass='my-custom-class'>
...
</IonModal>
)
edit: fixed typo brackets
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…