Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. import React from 'react';
  2. import './App.css';
  3. import DropdownButton from 'react-bootstrap/DropdownButton';
  4. import Dropdown from 'react-bootstrap/Dropdown';
  5.  
  6. class App extends React.Component {
  7. constructor() {
  8. super();
  9.  
  10. this.state = {
  11. dropDownValue: "Select an item"
  12. }
  13. }
  14.  
  15. changeValue(text) {
  16. this.setState({dropDownValue: text})
  17. }
  18.  
  19. render() {
  20. return (
  21. <div className="App">
  22. <header className="App-header">
  23. </header>
  24. <div>
  25. <DropdownButton id="dropdown-item-button" title={this.state.dropDownValue} className="format">
  26. <Dropdown.Item as="button"><div onClick={() => this.changeValue(this.textContent)}>Item #1</div></Dropdown.Item>
  27. <Dropdown.Item as="button"><div onClick={() => this.changeValue(this.textContent)}>Item #2</div></Dropdown.Item>
  28. <Dropdown.Item as="button"><div onClick={() => this.changeValue(this.textContent)}>Item #3</div></Dropdown.Item>
  29. </DropdownButton>
  30. </div>
  31. </div>
  32. );
  33. }
  34. }
  35.  
  36. export default App;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement