{"version":"1.0","type":"rich","title":"Hook that returns the previous value.","description":"This example demonstrates a custom React hook that retains and returns the previous value of a prop or state variable between renders. The hook uses `useRef` to store the current value and `useEffect` to update the ref whenever the value changes, while returning the ref’s previous value from the render. It is written in TypeScript and relies on React’s `useEffect` and `useRef` APIs, showing a common pattern for comparing current and prior values in component logic.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-8e03303a568cceec6f2e3f31f4c650f3?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}