this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Memoize the Parent

+5 -2
+5 -2
src/components/media.jsx
··· 1 1 import { getBlurHashAverageColor } from 'fast-blurhash'; 2 - import { useCallback, useRef, useState } from 'preact/hooks'; 2 + import { useCallback, useMemo, useRef, useState } from 'preact/hooks'; 3 3 import QuickPinchZoom, { make3dTransformValue } from 'react-quick-pinch-zoom'; 4 4 5 5 import Icon from './icon'; ··· 79 79 onUpdate, 80 80 }; 81 81 82 - const Parent = to ? (props) => <Link to={to} {...props} /> : 'div'; 82 + const Parent = useMemo( 83 + () => (to ? (props) => <Link to={to} {...props} /> : 'div'), 84 + [to], 85 + ); 83 86 84 87 if (type === 'image' || (type === 'unknown' && previewUrl && url)) { 85 88 // Note: type: unknown might not have width/height