I'm relatively new to using react.js. I have a series of button at the top of the div, and when each one of them is pushed I would like to display a different set of text. I have been able to create a function that is activated when a button is pressed (and test it with an alert), but I can't seem to figure out how to have it present a different set of text for each different button or how to pass it based on which button is pressed.
class App extends Component {
handleClick() {
alert("Test");
}
render() {
return (
<body>
<div class="App">
<div class="floating-box">
<div class="search-tickets">
<button id="demo" class="color-button">Button 1</button>
<button class="color-button button2">Button 2</button>
<button class="color-button button3">Button 3</button>
<button ref="test" class="color-button button4" onClick={this.handleClick}>Button 4</button>
<h1 class="h1-text">Text</h1><br/>
<h2>
<br/>-123
<br/>-456
<br/
</h2>
</div>
</div>
</div>
</body>
);
}
export default App;
Ideally what I'm looking to do is have a different paragraph of text displayed below the buttons when each one of them are clicked. I've seen posts looking to change the button text or color, but not really impact a separate piece of text.
Any guidance on this would be incredibly helpful.