Skip to content

Commit

Permalink
onSubmit
Browse files Browse the repository at this point in the history
  • Loading branch information
IhorKaren committed May 4, 2023
1 parent 64209cb commit 93914b9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class App extends Component {
return (
<Container>
{this.state.loading && <Loader />}
<SearchBar getImages={this.getImages} />
<SearchBar onSubmit={this.getImages} />
<ImageGallery images={images} />
{showLoadMoreButton ? null : (
<Button buttonClick={this.handleLoadMoreClick} />
Expand Down
4 changes: 2 additions & 2 deletions src/components/Searchbar/Searchbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
SearchFormErrorMessage,
} from './Searchbar.styled';

const SearchBar = ({ getImages }) => {
const SearchBar = ({ onSubmit }) => {
const validationSchema = Yup.object().shape({
imageSearch: Yup.string().trim().required('Search field cannot be empty'),
});
Expand All @@ -19,7 +19,7 @@ const SearchBar = ({ getImages }) => {
initialValues={{ imageSearch: '' }}
validationSchema={validationSchema}
onSubmit={(values, { resetForm }) => {
getImages(values.imageSearch.trim());
onSubmit(values.imageSearch.trim());
resetForm();
}}
>
Expand Down

0 comments on commit 93914b9

Please sign in to comment.