Difficulty: 6/10custom hooks, window.matchMedia, SSRjavascriptCopyScenario Questions0-2 years experience1How would you write a simple useMediaQuery hook that returns true when the viewport matches a given CSS media query string?2If you call your hook with '(max-width: 600px)' and then resize the window, what steps does your hook need to take to update the component?2-5 years experience1We have a component that shows a mobile navigation drawer only on screens smaller than 768px. It sometimes doesn't hide when the window is resized larger. Walk me through how you'd debug the useMediaQuery implementation.Follow-up QuestionsWhat would happen if you omitted the cleanup function?How does your hook behave during the initial render on the server?Can you think of any performance implications of many components using this hook?Suggest Improvement