React | how to display random string from array and choose another random on btn press

So I’m learning react and wanted to make an idea generator that would pull a string from an array (the ‘researchTitles’) file, and display it in the h1 and then on the button click it would pick another at random and display that. so far I’ve just got the outline and the method to pick a string at random, is there a better way to do this? and if so can I get some help

import researchTitles from './
import React from 'react';

function App() {

  const title = researchTitles[Math.floor(Math.random() * researchTitles.length)];
  
  return (
    <div className="App">
      <h1>{title}</h1>
      <button onClick={}>Generate</button>
    </div>
  );
}

export default App;