What do you want to save?
Add Code snippet
New code examples
-
Other 2022-02-17 17:00:03
componentdidmount functional hook
import { useState, useEffect } from 'react'; function getWindowDimensions() { const { innerWidth: width, innerHeight: height } = window; return { width, height }; } export default function useWindowDimensions() { const [windowDimensions,... Add solution -
Javascript 2022-01-27 05:00:40
how to set state when change viewport react
import React, { useLayoutEffect, useState } from 'react'; function useWindowSize() { const [size, setSize] = useState([0, 0]); useLayoutEffect(() => { function updateSize() { setSize([window.innerWidth, window.innerHeight]); } wi... Add solution -
Javascript 2021-11-12 23:53:15
javascript debounce function
// Returns a function, that, as long as it continues to be invoked, will not // be triggered. The function will be called after it stops being called for // N milliseconds. If `immediate` is passed, trigger the function on the // leading edge, instead of ... Add solution -
Javascript 2021-10-06 08:26:03
react get dynamic window sizes
import { useState, useEffect } from 'react'; function getWindowDimensions() { const { innerWidth: width, innerHeight: height } = window; return { width, height }; } export default function useWindowDimensions() { const [windowDimensions,... Add solution -
Other 2021-09-29 03:42:03
debounce
// Returns a function, that, as long as it continues to be invoked, will not // be triggered. The function will be called after it stops being called for // N milliseconds. If `immediate` is passed, trigger the function on the // leading edge, instead of ... Add solution
Best helpers
Arad
+5
JoshuaFicy
+5
Majte
+5
Entrepreneur
+5
Meital Regev
+5
Shenkwen
+5
Digcoal
+5
A G Davey
+5
NeuronQ
+5
Emmet
+5
Muazam
+5
Vigrond
+5
Scoiattolo
+5
Erica Price
+5