fix: 🐛 check window.Event constructor exists in useLocation

IE does not have window.Event constructor.
This commit is contained in:
streamich 2019-11-10 20:03:41 +01:00
parent dbf18e8e70
commit ad09431145

View File

@ -84,4 +84,6 @@ const useLocationBrowser = (): LocationSensorState => {
return state;
};
export default isClient ? useLocationBrowser : useLocationServer;
const hasEventConstructor = typeof Event === 'function';
export default isClient && hasEventConstructor ? useLocationBrowser : useLocationServer;