so im trying to have a button where the user by pressing it, will display on the screen some fetched data from an API. so far so good i fetched the data and when press the button it prints the result. but i want to create one more button, where if the user press, it will print a random json data from the API every 3 seconds(like random quotes), right now i just have it just by pressing once and get one random solid displaying. is there a way with hooks on how to do it? Edit: the problem that i encounter is that it prints no matter what the user press, if he press to get one joke it always changes, and i dont want that.
first button that i have
<button id="button" onClick = {getQuote}>Get one quote</button> <h3 dangerouslySetInnerHTML = {{__html: quote}} />
and the second button/toggle(for start stop) bellow for getting/appearing a random joke every 3 seconds on screen
<button id="button" onClick = {handleGetT}>{isActive ? 'Get quotes' : 'Stop'}</button> <h3>{isActive ? null : quote}</h3>