diff --git a/src/SocialSharing.jsx b/src/SocialSharing.jsx index f2a5726..4f4a443 100644 --- a/src/SocialSharing.jsx +++ b/src/SocialSharing.jsx @@ -21,7 +21,7 @@ const SocialSharing = ({ }) => { const [currentUrl, setCurrentUrl] = useState(''); const [display, setDisplay] = useState(true); - const pathName = location.pathname; + const pathName = location?.pathname; useEffect(() => { setCurrentUrl(window.location.href); @@ -29,7 +29,7 @@ const SocialSharing = ({ // Disable sharing on non content routes useEffect(() => { - setDisplay(!isCmsUi(pathName)); + pathName && setDisplay(!isCmsUi(pathName)); }, [pathName]); // MOBILE checker