refactored search movie handler function

This commit is contained in:
andres alcocer
2021-10-07 17:06:06 -04:00
parent 0bbbb9d5f3
commit f6a828e243
6 changed files with 82 additions and 20 deletions

View File

@@ -17,12 +17,17 @@ export default class Search extends Component {
}
componentDidMount = async () => {
console.log('movie roww', movieRows)
const { movieRows } = this.props.history.location;
if (movieRows)
if (movieRows) {
await this.setState({ movies: movieRows });
}
}
componentDidUpdate = async (prevProps) => {
console.log('hiiiiiii')
if (
prevProps.location.movieRows.length !==
this.props.location.movieRows.length
@@ -62,6 +67,7 @@ export default class Search extends Component {
render() {
const { movies } = this.state
const { userInput } = this.props.location
console.log('search().render()', this.props.history.location)
return (
<>