useMemo

const {useState, useMemo} = React

const App = () => {

  const [count, setCount] = useState(0)

  const someNum = useMemo(() => {

    return Math.random()

  }, [])

  return 

random number: {someNum}
}

你可能感兴趣的:(useMemo)