ndresx / react-countdown

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

How to start and pause in functional React #215

Closed OOCAZ closed 1 year ago

OOCAZ commented 1 year ago

Hey all,

I am sorry I don't know the repo so well but I am trying to implement in functional react with no classes (newer standards and all). I am completely lost on how to implement the getAPI() and the start and pause.

Any chance someone could whip up a quick example?

Thank you for your time!

ndresx commented 1 year ago

Hi, maybe this comment helps you find a solution https://github.com/ndresx/react-countdown/issues/125#issuecomment-825996457?

OOCAZ commented 1 year ago

yes I believe that does help, would you like me to make a short example to add to the repo? Could make it easier for others to integrate? Will verify later, but thank you for your help.

ndresx commented 1 year ago

Hi, if you have time, yes, please! You could base it on this example here https://github.com/ndresx/react-countdown/blob/master/examples/src/CountdownApi.tsx, which is used here https://github.com/ndresx/react-countdown/blob/master/examples/src/index.tsx, and create a functional component version out of it to have a direct comparison/reference.

OOCAZ commented 1 year ago

I will do my best to get that working later tonight

OOCAZ commented 1 year ago

will work on it this weekend, finally have some time lol

ndresx commented 1 year ago

I'm closing this since the original question got answered; thank you!