전체 글
-
GraphQL Query & MutationLanguages/GraphQL 2023. 8. 13. 14:14
GraphQL은 REST API와 달리 클라이언트단에서 Query와 Mutation을 작성하여 호출합니다.(덕분에 Frontend에서 처리해야 할 작업이 많습니다...) 기존 REST API는 URL과 Method를 조합해 다양한 Endpoint가 있는 반면 GQL은 하나의 Endpoint을 가지기 때문에 Endpoint에 따라 DB SQL 쿼리가 달라지지 않고 GQL 스키마의 타입에 따라 쿼리가 달라집니다.(GQL 스키마의 타입을 GQL Code Generator을 통해 Front로 가져와 확인하는 것이 편합니다.) 그래서 GQL의 장점인 한 번의 API 호출로 여러 처리가 가능합니다. Query & Mutation GQL에선 Query와 Mutation으로 나누는데 구조는 비슷합니다. 다만 Query..
-
useEffect vs useLayoutEffectFrameworks, Platforms and Libraries/React 2023. 8. 6. 17:22
Vue.js legacy 코드를 React로 porting 하면서 기존에 사용 중이던 video.js에서 warning이 뜨는 현상이 발견되었습니다. The YouTube player is not attached to the DOM. API calls should be made after the onReady event. 디버깅을 하다 보니 video.js를 Cleanup 하는 상황에서 해당 warning이 발생하였습니다. ... const videoPlayer = useRef(null); useEffect(() => { videoPlayer.current = videojs(video.current!, options()); return () => { if (videoPlayer.current) { // ..