text: import { useEffect, useState } from "react"
  import { getBooks } from "../services/getBooks";
  
  
  export const useFetchRecommendedBooks = ( topics = [] ) => {	
  
  	const [ state, setState ] = useState({
  		
  		data: [],
  		loading: true,
  		
  	})
  
  	console.log( topics )
  	
  	const getRecommendations = async (topics) => {
  		const booksList = (await Promise.all(topics.map( async (t) => await getBooks(t, 1)))).flat();
  		setState({ data: [ ...booksList ], loading: false })
  	}
  
  	useEffect( () => {
  		if( topics.length > 0){
  			getRecommendations(topics);
  		}
  	}, [ topics ] )
  	
  	return state;
  
  }