How To Cache Images in React?
问题 Suppose I have a list of url's like so : [ '/images/1', '/images/2', ... ] And I want to prefetch n of those so that transitioning between images is faster. What I am doing now in componentWillMount is the following: componentWillMount() { const { props } = this; const { prefetchLimit = 1, document = dummyDocument, imgNodes } = props; const { images } = document; const toPrefecth = take(prefetchLimit, images); const merged = zip(toPrefecth, imgNodes); merged.forEach(([url, node]) => { node