This file contains 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
import { getInitialState, syncLocalStorageWithRedux } from './util-localStorage' | |
const reduxStorageKey = 'my-application:' | |
const ONE_SECOND = 1000 | |
const ONE_MINUTE = ONE_SECOND * 60 | |
const ONE_HOUR = ONE_MINUTE * 60 | |
const ONE_DAY = ONE_HOUR * 24 | |
const ONE_YEAR = ONE_DAY * 365 | |
// create a white list. key is the redux store key, and lifeSpan is |
This file contains 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
import React, { useEffect, useRef, useState } from 'react' | |
import './LazyImage.scss' | |
const LazyImage = (props) => { | |
const [ isLoaded, setIsLoaded ] = useState(false) | |
const [ isVisible, setIsVisible ] = useState(false) | |
const { src, alt, width, height, className } = props | |
const placeHolderStyle = {paddingBottom: `${(height / width) * 100}%`} | |
const imageRef = useRef() |