[react native] api 사용하기 (get stylist top keywords)


[react native] api 사용하기 (get stylist top keywords)

1. 서버와 연동하는 api 생성 우린 axios 사용 export const getStylistTopKeywords = async stylistId => { const res = await axios .get(`/stylist/${stylistId}/top_keywords`) .then(({ data }) => data) .catch(); return res; }; 2. container에서 연결 const [topKeywords, setTopKeywords] = useState([]); const fetchStylistTopKeywords = async () => { const res = await getStylistTopKeywords(id); setTopKeywords(res); }; 3. screen에서 컴포넌트 불러오기 {reviewList.length >= 1 && ( <View style={styles.reviewContainer}> {/* title */} <Text...



원문링크 : [react native] api 사용하기 (get stylist top keywords)