React Native2 [React Native] axios interceptors를 이용해서 헤더 업데이트하기 1. 기존 코드// apiClient.tsimport axios from 'axios';import { getBaseUrl } from '../constants/api';import { getHeaders } from './headers';const useApiClient = () => { const apiClient = axios.create({ baseURL: getBaseUrl(), headers: getHeaders(), }); return apiClient;};const apiClient = useApiClient();export default apiClient;// profile.tsx, 유저의 프로필을 api 요청으로 가져오는 코드import axios from 'axios'.. 2024. 9. 29. [ReactNative] Image Url 렌더링 21.07.20241. 기존 코드처음 mockData를 만들었을 때의 코드는 로컬 패스와 uri를 구분하지 않았다.const mockData = { { src: 'https://image-on-the-internet.url'}, { src: '../local/image/path'},}// ... 2. 해결 코드현재의 mockData와 Image 안의 코드는 이렇게 수정되었다.const mockData = { { src: 'https://image-on-the-internet.url'}, { src: null },}// ...import DefaultImg from '../local/image/path.png';// ...3. 원리uri는 인터넷의 소스를 가져올 때 사용하는 프로퍼티이기 때문에 네트.. 2024. 7. 21. 이전 1 다음