How can call two API with condition in react js?

HI All & @DanCouper

Am in the learning phase so please let me know if something feels illogical. I have been trying to use show result in a way that by default a user should see the trending API results and when he starts searching the other API with search query will trigger or get called. I tried to use if-else but there is no result. It shows the blank. I do not know how can I achieve it. Would really appreciate it if you can help me with this.

Please see the code I have tried. I do not know if it is the logical way or not. Thanks a million in advance.

useEffect (()=> {
        const getMovieList  = async () => {
            const TrendingUrl = 'https://api.themoviedb.org/3/trending/all/day?api_key=apikey_id' ;
            
            const allResultsUrl = `http://api.themoviedb.org/3/search/movie?api_key=apikey_id&query=${props.searchText}`;
                 
            const response = await fetch (props.searchText === "" ? TrendingUrl : allResultsUrl);
                    try {
                        const responseJson = await response.json();
                        const data = (responseJson.results);
                        setMovieData(data);
                        console.log(data)
                    } catch (err) {
                        console.error(err);
                    }
            
        };
     getMovieList();

     
 }, [props.searchText]);