This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//react page size tracker | |
export const useWindowResize = () => { | |
const [width, setWidth] = useState(window.innerWidth); | |
const [height, setHeight] = useState(window.innerHeight); | |
const listener = () => { | |
setWidth(window.innerWidth); | |
setHeight(window.innerHeight); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Destructuring assignment in ES6 - Adi Booker | |
-------------------------------------------- | |
With these concepts, you can efficiently extract values from objects, handle nested data structures, and provide fallback values when necessary, leading to cleaner and more readable code. | |
A [Pen](https://codepen.io/Indefy/pen/WNmYwzL) by [Adi Booker](https://codepen.io/Indefy) on [CodePen](https://codepen.io). | |
[License](https://codepen.io/license/pen/WNmYwzL). |