My app connects to a bluetooth device and is constantly retrieving data from it, storing the data in state, and rendering it to the screen. Additionally, I have a button on the screen that needs to do something (say, console log a message). My problem is that the setState is triggering a re-render so rapidly (think milliseconds) that when you press the button, nothing happens. If I keep pressing the button over and over, eventually it will catch and console log. How can I fix this where I can show the updated data constantly while also being able to click on the button?
I have tried removing the rapid set states and everything works as expected, so I am confident the button functionality is due to the quick, repetitive re-rendering.