Skip to content

Instantly share code, notes, and snippets.

@hieptlccc
Created January 9, 2022 08:40
Show Gist options
  • Save hieptlccc/5aee01962235de7075233b014fa326c3 to your computer and use it in GitHub Desktop.
Save hieptlccc/5aee01962235de7075233b014fa326c3 to your computer and use it in GitHub Desktop.
modal.js - webex clone
import { useState } from 'react';
const withModal = ModalComponent => WrapperComponent => {
return function () {
const [isModalShown, setIsModalShown] = useState(false);
return (
<>
<WrapperComponent toggleModal={setIsModalShown}/>
{isModalShown && <ModalComponent toggleModal={setIsModalShown} />}
</>
)
}
}
export default withModal;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment