React Hook to estimate read time for a provided text.
npm install use-read-time> React Hook to estimate read time for a provided text.
 
``bash`
npm install --save use-read-time
`jsx
import { useReadTime } from "use-read-time";
const ExampleMinuteNumber = () => {
const { readTime } = useReadTime({
text: "Hello book with all but long paragraphs.",
});
console.log("ExampleMinuteNumber :: readTime", readTime); // 1
return
`jsx
import { useReadTime } from "use-read-time";const ExampleReadTimeLabel = () => {
const { readTimeLabel } = useReadTime({
text: "Hello book with all but long paragraphs.",
});
console.log("ExampleReadTimeLabel :: readTime", readTime); // Around 1 minute.
return
🤓 🏷️
;
};
``jsx
import { useReadTime } from "use-read-time";const ExampleReadTimeInfo = () => {
const { readTimeLabel } = useReadTime({
text: "Hello book with all but long paragraphs.",
});
console.log("ExampleReadTimeInfo :: readTimeInfo", readTimeInfo); // 1 min read
return
🤓 🗣
;
};
`$3
| Field | Type | Description | Required | Default |
| ----- | ------ | -------------------------------------------------------------------------------------------- | -------- | ------- |
| text | String | Text to calculate the amount of reading minutes for. | yes | |
| speed | Enum |
fast (240 wpm), normal (180 wpm), slow (100 wpm) - indicating the reading speed. | no | |
| wpm | Int | Number representing the word per minute to calculate the estimate time to read. | no | 180` |MIT © @ScottAgirs
---
#### Credits
Package by @ScottAgirs.
This hook is created using create-react-hook.