Ian McNally

Event pooling in React

August 18, 2015

I’ve been writing a lookahead/autocomplete component in React, with a debounced onChange. I started to notice that my value changes would be out of sync with the debounced function, but work fine if there was no debounce. As of three days ago, React finally adding documentation on how they pool events. Read on.

The long and short? It’s there for performance. If you need to access the event asynchronously, call event.persist().


Ian McNally

Hey, I'm Ian. I build websites and write about what I learn as I go. Follow me on Twitter.