ndresx / react-countdown

A customizable countdown component for React.
MIT License
748 stars 69 forks source link

use multiple countdown #168

Closed amirsam00 closed 2 years ago

amirsam00 commented 2 years ago

hi, i want to use multiple countdown instance in tr of a table and I want to delete the row whenever it's countdown finished, How can I do this?

`renderer({hours, minutes, seconds, completed, ...rest}){ if (completed) { // i need here tr related to this coundown return expire; } else { // Render a countdown if (seconds == 0) return ''; return

{seconds}
; } } render() { const currentRow = this.props.row; return (

{currentRow.qty} {currentRow.registerTime}
        )

}`

ndresx commented 2 years ago

Hi, check the https://github.com/ndresx/react-countdown#oncomplete callback function. With that, you should be able to accomplish what you are trying to do!

amirsam00 commented 2 years ago

thanks, how can i access parent td of each countdown that completed in oncomplete function and then remove it?

ndresx commented 2 years ago

Hmm, there are multiple ways. For example, using different onComplete callbacks as mentioned before, or using lodash to put an index of your row into the arguments list when called.