Skip to content

十二、useMemo缓存函数结果

js
function sum(a,b){
    return a+b
}
const App=()=>{
    let a=1
    let b=3
    const result=useMemo(()=>{
        return sum(a,b)
    },[a,b])//依赖项
}