Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completed part-5 #16

Open
wants to merge 1 commit into
base: part-5-start
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<title>React Todo List</title>
</head>
<body>
<h1>This is not a React app yet!</h1>
<div id="app"></div>
<script src="bundle.js"></script>
</body>
Expand Down
9 changes: 7 additions & 2 deletions components/App.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import React, { Component } from 'react'
import TextInput from './TextInput'

class App extends Component {

render() {
return <div>This is definitely a hot (module reloading) React app now!</div>
return (
<div>
<h1>This is the App Component</h1>
<TextInput/>
</div>
)
}

}

export default App
10 changes: 10 additions & 0 deletions components/TextDisplay.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React, { Component } from 'react'

class TextDisplay extends Component {

render() {
return <div>I am displaying text: {this.props.text}</div>
}
}

export default TextDisplay
34 changes: 34 additions & 0 deletions components/TextInput.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React, { Component } from 'react'
import TextDisplay from './TextDisplay'

class TextInput extends Component {

constructor(props, context) {
super(props, context)
this.state = {
inputText: 'initial text'
}
}

handleChange(event) {
this.setState({
inputText: event.target.value
})
}

render() {
return (
<div>
<input
type="text"
placeholder="This is going to be text"
value={this.state.inputText}
onChange={this.handleChange.bind(this)}
/>
<TextDisplay text={this.state.inputText}/>
</div>
)
}
}

export default TextInput