{"size": 917, "ext": "js", "max_stars_repo_path": "src/App.js", "max_stars_repo_name": "marijanbrvar/My-Github-user-finder", "max_stars_repo_stars_event_min_datetime": "2021-09-10T08:50:19.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-10T08:50:19.000Z", "max_issues_repo_path": "src/App.js", "max_issues_repo_name": "marijanbrvar/My-Github-user-finder", "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": "marijanbrvar/My-Github-user-finder", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 26.9705882353, "max_line_length": 178, "alphanum_fraction": 0.6444929117}
import React, { Component } from 'react';
import axios from 'axios';
import './App.css';
import Navbar from './components/layout/Navbar';
import Users from './components/users/Users';
import Search from './components/users/Search';
class App extends Component{
  state = {
    users: [],
    loading: false
  }

  searchUser = async (text) => {
    this.setState({loading: true})
    const res = await axios.get(`https://api.github.com/search/users?q=${text}&client_id=${process.env.REACT_APP_GITHUB_ID}&clinet_secret=${process.env.REACT_APP_GITHUB_SECRET}`)

    this.setState({users: res.data.items, loading: false})
  }

  render() {
    return (
      <div className="App">
        <Navbar />
        <div className='container'>
          <Search searchUser={this.searchUser}/>
          <Users loading={this.state.loading} users={this.state.users}/>
        </div>
      </div>
    );
  }
}

export default App;
