본문 바로가기

useQuery3

[TIL] 내일배움캠프 React 과정 2023.01.25 Today I Learned Recoil 공부하기 리스트 클릭 시 지도에서 해당 위치로 이동하도록 구현하기 Recoil 공부하기 const todoListState = atom({ key: 'todoListState', // unique ID default: [], // initial value }); const [todoList, setTodoList] = useRecoilState(todoListState); 코드 몇 줄로 전역 상태 관리 끝... 공식 문서 https://recoiljs.org/ko/docs/introduction/getting-started/ https://recoiljs.org/ko/docs/basic-tutorial/atoms https://recoiljs.org/ko/docs.. 2023. 1. 26.
[TIL] 내일배움캠프 React 과정 2023.01.09 Today I Learned React Native 팀 프로젝트 진행 Firestore onSnapshot과 useQuery const getComments = async () => { const q = query( collection(dbService, "communityComments"), orderBy("date", "desc") ); const array = []; await onSnapshot(q, (snapshot) => { snapshot.docs.map((doc) => ( array.push({ id: doc.id, ...doc.data() }))) setComments(array) }) return array; }; const data = useQuery("communityComments.. 2023. 1. 10.
[TIL] 내일배움캠프 React 과정 2023.01.08 Today I Learned 팀 프로젝트 진행 new Date()로 날짜 출력하기 댓글을 작성할 때 date: new Date()를 이용해서 작성 날짜를 저장하고 date를 이용해서 댓글을 최신순으로 정렬할 수 있었다. 근데 댓글을 작성한 날짜를 화면에 보여줄 때 new Date()로 생성한 날짜를 그대로 가져오면 에러가 발생한다. Objects are not valid as a React child (found: object with keys {seconds, nanoseconds}). If you meant to render a collection of children, use an array instead. firestore에서 확인해봤더니 new Date()로 생성한 데이터는 문자열 형태가 아니라.. 2023. 1. 8.