score:1

const Parent = () => {
    const [childModalOpen, setChildModalOpen] = useState(false);
    return (
        <Child
            modalOpen={childModalOpen}
            onModalChange={(open) => setChildModalOpen(open)}                                                         
            {...otherProps}
         />);
};
const Child = ({ modalOpen, onModalChange }) => {
    const [open, setOpen] = useState(open);

    useEffect(() => {
        setOpen(modalOpen);
    }, [modalOpen]);

    const handleOpen = () => {
        onModalChange(true);
    };
    const handleClose = () => {
        onModalChange(close);
    };

    return (
        <Modal open={} onClose={handleClose}>
            {* children *}
        </Modal>);
};

Related Query

More Query from same tag