{"size": 1107, "ext": "js", "max_stars_repo_path": "src/App.js", "max_stars_repo_name": "numan536/apicalls", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/App.js", "max_issues_repo_name": "numan536/apicalls", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/App.js", "max_forks_repo_name": "numan536/apicalls", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 19.7678571429, "max_line_length": 108, "alphanum_fraction": 0.6088527552}
import React from 'react';
import logo from './logo.svg';
import axios from 'axios'
import Searchbar from './Searchbar';
import './App.css';
import ImageList from './ImageList'

class App extends React.Component{
  state={data:[] ,  
    term: ""
  }

  handleChange=(event)=>{
    this.setState({
      name: event.target.value
    })

    console.log(this.state.term)
}
onClickTo =()=>{
  this.setState({
      term: this.state.onSearchSubmit
  })
}



   onSearchSubmit = async ()=>{
    const response = await axios.get('https://api.unsplash.com/search/photos',{
      params:{
        query: 'cars',
        client_id:'0CGTS9Grt3NddfiDUdK8_Ea9e2aZoiZ4ZT3BKaKim_Y'
      },
    // headers:{
    //   Authorization : '0CGTS9Grt3NddfiDUdK8_Ea9e2aZoiZ4ZT3BKaKim_Y'
    // }
    })
    this.setState({
      data: response.data.results
    })
   
  }
  render(){
    
    return(
      <div>
        <Searchbar term={this.state.term} onSubmit={this.onSearchSubmit} handleChange={this.handleChange} />
        <hr />
        <ImageList data={this.state.data} />
      </div>
    )
  }
}

export default App;
