react-typist icon indicating copy to clipboard operation
react-typist copied to clipboard

update documentation (dynamic content)

Open ohzecodes opened this issue 3 years ago • 0 comments

Developers can use the on typing done method when to give a dynamic text looping through the array. The typist can then be compiled with delay and backspace to delete and give a dynamic feeling.

Kindly update the section with Dynamic content usage in your documentation with the following code.

let texts=["one","two","three" ]
const [currentTextCounter, setCurrentTextCounter] = useState(0);

<Typist
          key={currentTextCounter}
          onTypingDone={() => {
            if (currentTextCounter < texts.length - 1) {
              setCurrentTextCounter(currentTextCounter + 1);
            } else {
              setCurrentTextCounter(0);
            }
          }}  >
          {texts[currentTextCounter]}
           </Typist>


ohzecodes avatar May 18 '22 03:05 ohzecodes