Skip to content

Commit

Permalink
update text's state on user input
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnsull3 committed Feb 20, 2020
1 parent c30f069 commit aa885b5
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 10 deletions.
16 changes: 14 additions & 2 deletions dist/bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ <h1>Movie List</h1>
<div id="app">

</div>

<script src="bundle.js" charset="utf-8"></script>
</body>
</html>
44 changes: 37 additions & 7 deletions src/components/App.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import Search from './Search.js';
import '../main.css';

var movies = [
Expand All @@ -10,15 +11,44 @@ var movies = [
];

class App extends React.Component {
constructor(props){
super(props)
this.state = {
movies: movies,
text: ''
}
this.handleSubmit = this.handleSubmit.bind(this);
this.handleText = this.handleText.bind(this);

}

handleSubmit() {

}

handleText (e) {
this.setState({ text: e.target.value });
}


render(){
return(
<div>
<div className="title">{movies[0].title}</div>
<div className="title">{movies[1].title}</div>
<div className="title">{movies[2].title}</div>
<div className="title">{movies[3].title}</div>
<div className="title">{movies[4].title}</div>
</div>
<div>
<nav className="navbar">
<div>
<Search
handleText={this.handleText}
handleSubmit={this.handleSubmit}/>
</div>
</nav>
<div className="movieList">
<div className="title">{movies[0].title}</div>
<div className="title">{movies[1].title}</div>
<div className="title">{movies[2].title}</div>
<div className="title">{movies[3].title}</div>
<div className="title">{movies[4].title}</div>
</div>
</div>
)}
}

Expand Down
Loading

0 comments on commit aa885b5

Please sign in to comment.