I ran into a need of cleaning a useEffect when component is unmounted but with an access to the current props. Like componentWillUnmount can do by getting this.props.whateve
You need to track count in useEffect:
count
useEffect
import React, { useEffect } from "react"; const B = ({ count }) => { useEffect(() => { return () => console.log(count); }, [count]); return {count}; }; export default B;