(Go Back) Choose State To Move From
') {
return false
}
if (this.state.searchKey === '') {
return false
}
return true
}
handleKeyPress = (e) => {
if (e.key === 'Enter') {
this.search()
}
}
render() {
return (
Search for a user
type="text"
placeholder="Enter username"
value={this.state.searchKey}
onChange={this.handleChange}
onKeyPress={this.handleKeyPress}
/>
{this.state.userFound ? (
{this.state.name}
{this.state.bio}
Followers
{this.state.followers}
Following
{this.state.following}
Repos
{this.state.public_repos}
{this.state.repos.map((repo, index) => (
{repo.name}
{repo.description}
Stars
{repo.stargazers_count}
Forks
{repo.forks}
Open Issues
{repo.open_issues}
))}
) : (
''
)}
{this.state.userNotFound ? (
No user found with name {this.state.searchKey}
) : (
''
)}
)
}
}
export default Search