mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 20:13:49 +00:00
Update: add more toast notifications, update position
Also set Account page to use UserContext. Refactored api requests out of components.
This commit is contained in:
@@ -18,8 +18,9 @@ import { useState, useEffect } from 'react';
|
||||
*/
|
||||
const useMediaQuery = (query: `(${string})`) => {
|
||||
/**
|
||||
* Initialize the matches state variable to false. This is updated whenever the viewport
|
||||
* size changes (i.e. when the component is mounted and when the window is resized)
|
||||
* Initialize the matches state variable to false. This is updated whenever the
|
||||
* viewport size changes (i.e. when the component is mounted and when the window is
|
||||
* resized)
|
||||
*/
|
||||
const [matches, setMatches] = useState(false);
|
||||
|
||||
@@ -34,8 +35,8 @@ const useMediaQuery = (query: `(${string})`) => {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a resize event listener to the window object, and update the `matches` state
|
||||
* variable whenever the viewport size changes.
|
||||
* Add a resize event listener to the window object, and update the `matches`
|
||||
* state variable whenever the viewport size changes.
|
||||
*/
|
||||
const listener = () => setMatches(media.matches);
|
||||
window.addEventListener('resize', listener);
|
||||
|
||||
Reference in New Issue
Block a user