Skip to content

Instantly share code, notes, and snippets.

@codeBelt
Last active October 13, 2020 17:29
Show Gist options
  • Save codeBelt/ce1761665e965313a56c0ba00a42afa0 to your computer and use it in GitHub Desktop.
Save codeBelt/ce1761665e965313a56c0ba00a42afa0 to your computer and use it in GitHub Desktop.
export const PortalIn = (props) => {
const { addPortalItem, removePortalItem } = useContext(PortalContext);
useEffect(() => {
addPortalItem(props.portalType, props.children);
return () => removePortalItem(props.portalType);
}, [props.portalType, props.children]);
return null;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment