File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ const useMedia = (
1515 const mediaQueryLists = queries . map ( ( q ) => window . matchMedia ( q ) ) ;
1616
1717 // Function that gets value based on matching media query
18- const getValue = ( ) => {
18+ const getValue = ( ) : any => {
1919 // Get index of first media query that matches
2020 const index = mediaQueryLists . findIndex ( ( mql ) => mql . matches ) ;
2121 // Return related value or defaultValue if none
@@ -30,11 +30,11 @@ const useMedia = (
3030 // Event listener callback
3131 // Note: By defining getValue outside of useEffect we ensure that it has ...
3232 // ... current values of hook args (as this hook callback is created once on mount).
33- const handler = ( ) => setValue ( getValue ) ;
33+ const handler = ( ) : void => setValue ( getValue ) ;
3434 // Set a listener for each media query with above handler as callback.
3535 mediaQueryLists . forEach ( ( mql ) => mql . addListener ( handler ) ) ;
3636 // Remove listeners on cleanup
37- return ( ) =>
37+ return ( ) : void =>
3838 mediaQueryLists . forEach ( ( mql ) => mql . removeListener ( handler ) ) ;
3939 } ,
4040 [ ] , // Empty array ensures effect is only run on mount and unmount
You can’t perform that action at this time.
0 commit comments