I am creating a Modal component and on a high level, it looks like this:
class Modal extends Component {
    hideModal() {
        /* logic to hide modal */
    }       
    render() {
        return (
            <section role="dialog" ... >
                <div className="modal-inner">
                    <header className="react-modal-header">{this.props.title}</header>
                    <div className="react-modal-body">{this.props.body}</div>
                    <footer className="react-modal-footer">{this.props.footer}</footer>
                </div>
            </section>
        );
    }
}
I want to provide a way for consumers of this component to specify a button that closes the modal. I was thinking of putting this button in its own component like so:
class ModalCloseButton extends Component {
    render() {
        return (
            <button type="button" onClick={/* call hideModal in Modal component */}>
                {this.props.text}
            </button>
        );
    }
}
The Modal component and the ModalCloseButton component would be used this way:
<Modal
    title="my awesome modal"
    body="this is the body of my awesome component"
    footer={
        <ModalCloseButton text="Close modal!"/>
    } 
/>
How can I link the Modal and ModalCloseButton components so that the onClick handler in the button component triggers the hideModal function in the Modal component?
 
     
     
     
     
    