I have a useMemo hook that wraps a component that only needs to re-render when its prop has certain shape (must not be null and must include a timestamp property).
In the below example my layout prop may have different values like null, {timestamp:1, ...}, again null...etc.
My aim is to utilize useMemo for allowing my component only re-render if layout has timestamp, otherwise it must return the memoized one.
import React, { useMemo } from "react";export default ({layout}) => { const {timestamp} = layout || {}; return useMemo(() => <div>current state: {timestamp}</div>, [timestamp]);}