When using Material-UI's Modal component (or any of the components built using it), is there any benefit in using the open prop vs. conditionally rending the component? I've noticed that you lose the nice closing transition, but is there any performance benefit if there are a lot of Modals?
Example using the open prop:
const [openModal, setOpenModal] = React.useState(false);
return (
/* code to set openModal to true */
<Modal open={openModal} onClose={() => setOpenModal(false)}>modal stuff here...</Modal>
);
Example using conditional rendering:
const [openModal, setOpenModal] = React.useState(false);
return (
/* code to set openModal to true */
{
openModal &&
<Modal open onClose={() => setOpenModal(false)}>modal stuff here...</Modal>
}
);