Ssh keys setup GitHub and bitbucket
https://medium.com/@trionkidnapper/ssh-keys-with-multiple-github-accounts-c67db56f191e
Photos
function App() { | |
// const isMounted = useIsMounted() | |
const isMounted = useIsMounted(); | |
React.useEffect(() => { | |
if (isMounted) { | |
console.log("i am mounted"); | |
} | |
}, [isMounted]); |
function App() { | |
const isMountedRefApproach = useIsMountedRef(); | |
React.useEffect(() => { | |
if (isMountedRefApproach.current) { | |
console.log("I am mounted"); | |
} | |
}, [isMountedRefApproach.current]); | |
React.useEffect(() => { |
const useIsMountedRef = () => { | |
const isMounted = React.useRef(false); | |
React.useEffect(() => { | |
isMounted.current = true; | |
return () => (isMounted.current = false); | |
}, []); | |
return isMounted; | |
}; |
import { utcToZonedTime, format as formatTimeZone } from 'date-fns-tz'; | |
//'America/Los_Angeles' | |
// const utcString = '2019-09-25T12:00:00.000Z'; | |
function getTimeZoneText(utcString) { | |
try { | |
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone; | |
if (Intl) { | |
const zoneDateObj = utcToZonedTime(utcString, timeZone); |
let callback = (entries, observer) => { | |
entries.forEach(entry => { | |
// Each entry describes an intersection change for one observed | |
// target element: | |
// entry.boundingClientRect | |
// entry.intersectionRatio | |
// entry.intersectionRect | |
// entry.isIntersecting | |
// entry.rootBounds | |
// entry.target |
let options = { | |
root: document.querySelector("#scrollArea"), // null | |
rootMargin: "0px 0px 0px 0px", | |
threshold: 1.0 // [0, 0.25, 0.50, 0.75, 1] | |
}; | |
let observer = new IntersectionObserver(callback, options); | |
let target = document.querySelector("#listItem"); | |
observer.observe(target); | |
observer.unobserve(target); |
React.useEffect(() => { | |
// your logic side-effect | |
}) | |
React.useEffect(() => { | |
// your logic side-effect | |
}, []) | |
React.useEffect(() => { | |
// your logic, side-effect |
function getTimeZoneText(utcString) { | |
try { | |
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone; | |
if (Intl) { | |
const zoneDateObj = utcToZonedTime(utcString, timeZone); | |
const timeZoneString = formatTimeZone(zoneDateObj, 'zzzz', { timeZone }); | |
return timeZoneString | |
.split(' ') | |
.map(elem => { | |
return elem.slice(0, 1); |
function useDebouncedEffect( | |
callback, | |
dependency, | |
timeout = 2000, | |
options = { trailing: true, leading: false } | |
) { | |
const { leading, trailing } = options; | |
// the source of truth will be _dependencyRef.current always | |
const [_dependency, _setdependency] = React.useState(dependency); |