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
// how to create a clockwise rotate animation with SwitchTransition and CSSTransition approach | |
// jsx | |
<div className="rotating-icon"> | |
<SwitchTransition> | |
<CSSTransition | |
key={state ? 'faChevronDown' : 'faChevronUp'} | |
addEndListener={(node, done) => node.addEventListener('transitionend', done, false)} | |
classNames="rotate" |
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
// exmpale to use Promise.all to preload all the iamges in the array to the app | |
// [loading, setLoading] = useState(false); | |
const cacheImages = async (srcArray) => { | |
const promises = await srcArray.map((src)=>{ | |
return new Promise((resolve, reject) => { | |
const img = new Image(); | |
img.src = src; | |
img.onload = resolve; |
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
//set the hardware clock | |
sudo hwclock --set --date="2020-04-28 18:07:50" | |
// syncronise the system clock to the hardware clock | |
sudo hwclock -s |