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
function Info({ radius }) { | |
<div> | |
<p>Radius:{radius}</p> | |
<p>Area:{(radius * radius * 22) / 7}</p> | |
</div>; | |
} | |
const MemoizedInfo = React.memo(Info); | |
function Circle({ radius, xCenter, yCenter }) { |
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 PropTypes from "prop-types"; | |
import React from "react"; | |
function Image({ src: ImageSrc, root, rootMargin, threshold, alt, ...props }) { | |
const [src, setSrc] = React.useState(false); | |
const imageRef = React.useRef(null); | |
const callback = React.useCallback((entries) => { | |
const [entry] = entries; | |
if (entry.isIntersecting) { |