A
A
Alex Polyakh2018-03-12 12:48:43
JavaScript
Alex Polyakh, 2018-03-12 12:48:43

Is there no way to clear 'interval' when we return it from another function and then call clear(clearInterval)?

Ready code:
https://stackblitz.com/edit/react-f2yr8t
When I assign the result of the function execution to a variable, then I pass it to clearInterval, everything works. Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Aksentiev, 2018-03-12
@Sanasol

Some kind of shitty question, it’s not clear what the question is, of course, you need to save the result of each call to the interval. it's a new interval every time.
Even if you wrap it in ten functions, you still call it several times.

C
Coder321, 2018-03-12
@Coder321

setInterval returns a unique identifier. screen

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question