I need to close the modal window by clicking on the link. My modal window:
export const ModalWrapper = (props) => {
const { children, title, modalName } = props;
return (
<div
className="modal fade"
id={`modal-${modalName}`}
tabIndex="-1"
role="dialog"
aria-labelledby="modal-label"
aria-hidden="true"
style={{ display: 'none' }}
>
<div className="modal-dialog modal">
<div className="modal-content" style={{ overflow: 'hidden' }}>
<div className="modal-header">
{ title }
<button type="button" className="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div className="modal-body" style={{ maxHeight: '435', overflowY: 'auto' }}>
<ul className="list-unstyled todo-list">
{children}
</ul>
</div>
</div>
</div>
</div>
);
};
How can I close window with react-router-dom Link?
It close window without redirect:
<Link to="/registration" data-dismiss="modal" className="btn btn-default">Registration</Link>
It redirects but the window does not close:
<Link to="/registration" className="btn btn-default">Registration</Link>
Thank you!