Declarative Events in ReactJS
Note to self
If you want to handle pathological use cases inside React using JavaScript's setInterval
function, use this sweet library called @use-it/interval
developed by Donavon.
Suppose you want to run a function periodically with a specified interval. But you need to control its behavior using another element like this: -
Here's the codesandbox demo for this.
Similarly, suppose you want to attach or detach any event-handling logic to an element or global scope (i.e., window
, document
) inside a React Hook (i.e., useEffect
). You can use @use-it/event-handler
.
How convenient!
Reading list
Well, now what?
You can navigate to more writings from here. Connect with me on LinkedIn for a chat.
2023
December
October
August
June
May
March
January