Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import logo from './logo.svg';
  3. import './App.css';
  4.  
  5. class App extends Component {
  6. state = {
  7. inputText: 'Hello World'
  8. listItem:[
  9. 'List Pertama',
  10. 'List Kedua',
  11. 'List ketiga'
  12. ]
  13. }
  14.  
  15. constructor(props) {
  16. super(props)
  17.  
  18. this.onChange = this.onChange.bind(this)
  19. }
  20.  
  21. onChange(event) {
  22. this.setState({
  23. inputText: event.target.value
  24. })
  25. }
  26.  
  27. render() {
  28. return (
  29. <div>
  30. <h1>{this.state.inputText}</h1>
  31. <input
  32. type="text"
  33. placeholder="Input nama"
  34. value={this.state.inputText}
  35. onChange={this.onChange} />
  36. {
  37. this.state.listItem.map((i))
  38. }
  39. </div>
  40. );
  41. }
  42. }
  43.  
  44. export default App;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement