Show or hide element in React
React circa 2020 In the onClick callback, call the state hook’s setter function to update the state and re-render: Run code snippetExpand snippet JSFiddle React circa 2014 The key is to update the state of the component in the click handler using setState. When the state changes get applied, the render method gets called again with the new state: