react-timing-hooks
react-timing-hooks copied to clipboard
"Leading" option for intervals
Status Quo / Problem / Topic By default, Javascript intervals do not call their callbacks on creation/startup, but only after the first cycle/timeout. There might be cases where this would be useful, though. Internally this package has such a use-case for example (iirc).
Solution
A leading option could allow executing the provided callback immediately upon start() (or mount if options.startOnMount=true).