r-use-cache
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

useCache

import React from 'react'
import { render } from 'react-dom'
import useCache from 'r-use-cache'

const App = () => {
  const value = useCache(() => {
    console.log('Compute only once')
    return 42
  }, [])
  return <div>{value}</div>
}

render(<App />, document.getElementById('root'))

Readme

Keywords

none

Package Sidebar

Install

npm i r-use-cache

Weekly Downloads

1

Version

0.1.1

License

none

Unpacked Size

21 kB

Total Files

217

Last publish

Collaborators

  • rozaxe