function componentDidUpdate(prevProps, prevState) {
			console.log("COMPONENT UPDATED");
			console.log(this.state.queryTerm);
			console.log(this.state.startYear);
			console.log(this.state.endYear);

			console.log("Previous State", prevState);

			if (this.state.queryTerm != "" && (prevState.queryTerm != this.state.queryTerm || prevState.startYear != this.state.startYear || prevState.endYear != this.state.endYear)) {
				helpers.runQuery(this.state.queryTerm, this.state.startYear, this.state.endYear).then(function (data) {
					if (data != this.state.results) {
						this.setState({
							results: data
						});
					}

					// console.log("RESULTS", results)
					// console.log("DATA", data)

					// This code is necessary to bind the keyword "this" when we say this.setState
					// to actually mean the component itself and not the runQuery function.
				}.bind(this));
			}
		}
/*If the user searches for the exact same thing, then React will ignore it.*/
If the user searches for the exact same thing, then React will ignore it.
If the user searches for the exact same thing then React will ignore it .
function componentDidUpdate(prevProps, prevState) {
			console.log("COMPONENT UPDATED");
			console.log(this.state.queryTerm);
			console.log(this.state.startYear);
			console.log(this.state.endYear);
			console.log("Previous State", prevState);
			if (this.state.queryTerm != "" && (prevState.queryTerm != this.state.queryTerm || prevState.startYear != this.state.startYear || prevState.endYear != this.state.endYear)) {
				helpers.runQuery(this.state.queryTerm, this.state.startYear, this.state.endYear).then(function (data) {
					if (data != this.state.results) {
						this.setState({
							results: data
						});
					}
				}.bind(this));
			}
		}
function componentDidUpdate ( prevProps , prevState ) { console . log ( "COMPONENT UPDATED" ) ; console . log ( this . state . queryTerm ) ; console . log ( this . state . startYear ) ; console . log ( this . state . endYear ) ; console . log ( "Previous State" , prevState ) ; if ( this . state . queryTerm != "" && ( prevState . queryTerm != this . state . queryTerm || prevState . startYear != this . state . startYear || prevState . endYear != this . state . endYear ) ) { helpers . runQuery ( this . state . queryTerm , this . state . startYear , this . state . endYear ) . then ( function ( data ) { if ( data != this . state . results ) { this . setState ( { results : data } ) ; } } . bind ( this ) ) ; } }
If the user searches for the exact same thing, then React will ignore it.
If the user searches for the exact same thing then React will ignore it .
// console.log("RESULTS", results) // console.log("DATA", data) // This code is necessary to bind the keyword "this" when we say this.setState // to actually mean the component itself and not the runQuery function.