Replies: 2 comments 8 replies
-
Where are you using this hook? in a server component? It won't work if used directly on a server component, it has to be used by a client component. |
Beta Was this translation helpful? Give feedback.
8 replies
-
Yeah im getting this error quite often, im embedding a page in an iframe and after a server action am having to redirect, but sometimes get this root exit status error |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
hello.
I am getting this error in the following js 13: Error: Unknown root exit status.
I have the code below, if (typeof window !== ‘undefined’) I apply it, I get Error: Unknown root exit status. I get this error and if I don't apply it, there is no error, but when I view the source, the file is in error. How can I deal with this situation?
‘use client’;
import { useCallback, useEffect, useLayoutEffect, useState } from ‘react’;
function useMediaQuery() {
const [matches, setMatches] = useState(false);
const handleCheckFuc = useCallback(() => {
if (typeof window !== ‘undefined’) {
const mediaQuery = window.matchMedia(‘(max-width: 767px)’);
setMatches(mediaQuery.matches);
}
}, []);
useEffect(() => {
handleCheckFuc();
}, [handleCheckFuc]);
return { isMobile: () => matches };
}
export default useMediaQuery;
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions