1.1.3 • Published 3 years ago
use-print-text v1.1.3
Use Print Text
This is a simple custom hook that prints text with an adjustable delay.
Installation
npm install use-print-textUsage
Hook returns ref.
import { usePrintText } from 'use-print-text';
const Component = () => {
    const divRef = usePrintText('foo', 200, {once: false, startDelay: 3000})
    
    return (
        <div ref={divRef} />
    );
}Syntax
usePrintText(text, delay, options)
Parameters
- textString to printed.
- delayTo delay printing. (default 200)
- options(optional)- once(default false)- trueWill print once even after re-rendering the parent component.
- falseThe print will re-render along with the parent component's render.
 
- startDelayDelay before printing. (default 500)