Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from 'react';
- import logo from './logo.svg';
- import './App.css';
- class App extends Component {
- state = {
- inputText: 'Hello World'
- listItem:[
- 'List Pertama',
- 'List Kedua',
- 'List ketiga'
- ]
- }
- constructor(props) {
- super(props)
- this.onChange = this.onChange.bind(this)
- }
- onChange(event) {
- this.setState({
- inputText: event.target.value
- })
- }
- render() {
- return (
- <div>
- <h1>{this.state.inputText}</h1>
- <input
- type="text"
- placeholder="Input nama"
- value={this.state.inputText}
- onChange={this.onChange} />
- {
- this.state.listItem.map((i))
- }
- </div>
- );
- }
- }
- export default App;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement