0.3.0 • Published 2 years ago

use-reading-time v0.3.0

Weekly downloads
52
License
MIT
Repository
github
Last release
2 years ago

Install

Using Yarn:

yarn add use-reading-time

Using NPM:

npm install --save use-reading-time

Usage

import React, { useRef } from 'react'
import Post from './post'

import useReadingTime from 'use-reading-time'

const Example = () => {
  const post = useRef()
  const {readingTime, wordsCount} = useReadingTime(post)

  return (
    <div>
      {readingTime} min • {wordsCount} words

      // You'll need to use `forwardRef` in this case
      <Post ref={post} />
    </div>
  )
}

Options/Params

useReadingTime(reference, wordsPerMinute)
ArgumentDescriptionTypeDefaultRequired
referenceA React ref objectObjectYes
wordsPerMinuteNumber of words we can read per minuteNumber260 (Source)No

License

MIT © diogomoretti

0.3.0

2 years ago

0.2.0

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago