Skip to content

Commit

Permalink
adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
robertotcestari committed Feb 17, 2022
1 parent 59bf4e3 commit 227e28a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class App extends React.Component {
this.setState({search:value})
}

handleFilterCharacters = () => {
handleFilterCharacters = (e) => {
e.preventDefault()
const { characters, search} = this.state;
const filteredArray = characters.filter(({name})=> name.toUpperCase().includes(search.toUpperCase()))
this.setState({filteredCharacters:filteredArray})
Expand All @@ -38,9 +39,9 @@ class App extends React.Component {
const {filteredCharacters, isLoading} = this.state
return (
<div className="App">
<form>
<form onSubmit={this.handleFilterCharacters}>
<input type='text' placeholder='Rick Sanchez...' onChange={this.handleOnChange}/>
<button type='button' onClick={this.handleFilterCharacters}>Buscar</button>
<button type='submit' >Buscar</button>
</form>
{
isLoading ? <Loading/> :
Expand Down

0 comments on commit 227e28a

Please sign in to comment.