保存上一次渲染时的状态
const [ prev: any, // 上一次的值] = useImage( state: any, // 要计算的值);
() => { const [count, setCount] = React.useState(0) const preCount = usePrevious(count) return ( <div> <div>preCount: {preCount}</div> <div>count: {count}</div> <button onClick={() => setCount(pre => pre + 1)}>+</button> </div> )}