Change onclick action with a Javascript function. To change a button's text on click in React: We set the onClick prop on the button element, so every time the button is In our handleClick function, we update the text of the button and use the In HTML, form elements such as ,