1
+ import React from 'react' ;
1
2
import { Component } from 'react' ;
2
3
import { ToastContainer } from 'react-toastify' ;
3
4
import Searchbar from './searchbar/searchbar' ;
4
- import api from 'components /service-api/pixabay-api' ;
5
+ import api from '. /service-api/pixabay-api' ;
5
6
import { toast } from 'react-toastify' ;
6
- import ImageGallery from 'components /imageGallery/imageGallery' ;
7
- import Button from 'components /button/button' ;
8
- import Loader from 'components /loader/loader' ;
9
- import Modal from 'components /modal/modal' ;
7
+ import ImageGallery from '. /imageGallery/imageGallery' ;
8
+ import Button from '. /button/button' ;
9
+ import Loader from '. /loader/loader' ;
10
+ import Modal from '. /modal/modal' ;
10
11
export class App extends Component {
11
12
state = {
12
13
searchQuery : '' ,
@@ -17,6 +18,7 @@ export class App extends Component {
17
18
showLoader : false ,
18
19
showModal : false ,
19
20
selectedImage : null ,
21
+ galleryRef : React . createRef ( ) ,
20
22
} // we got state 'searchQuery' from 'searchbar.js' (searchQueryOriginal=searchQuery)
21
23
22
24
async componentDidUpdate ( prevProps , prevState ) {
@@ -37,7 +39,7 @@ export class App extends Component {
37
39
showLoadMore : data . totalHits > 12 * currentPage ,
38
40
page : currentPage
39
41
} ) ;
40
- ! data . totalHits ? toast . error ( "No results found. Please try again!" ) : toast . success ( `Hooray! We found ${ data . totalHits } images` ) ;
42
+ ! data . totalHits && toast . error ( "No results found. Please try again!" ) ; // : toast.success(`Hooray! We found ${data.totalHits} images`);
41
43
nextPage >= totalPage && toast . warning ( "We're sorry, but you've reached the end of search results!" ) ;
42
44
} catch ( error ) {
43
45
this . setState ( { error } ) ;
0 commit comments