IT'S DO
[React] Route의 리스트의 id 받아오고, 배열.map((x, index) => (...)) 사용법
개발/React 2024. 11. 15. 16:55

React Routes는 리액트 기반의 웹 애플리케이션에서 클라이언트 측 라우팅을 관리하기 위한 네비게이션 라이브러리로써해당 URL에 맵핑을 시키기 위해서 사용한다. ## 문제그러면 보통, 게시글 같은 리스트의 id값을 리스트로 뿌려주게끔 만들었다. 그것을 route로 받고 싶으면 어떻게 할까? {cards.map((card, index) => ( {card.images?.map((img, i) => ( ))} {card.title} {card.address} {card.hours} ))}위와 같이 React js파일에서 리스트에 cards에 배열..

[JPA ERROR] Could not write JSON: Infinite recursion (StackOverflowError);
error 2024. 11. 14. 16:52

# ERROR: 2024-11-14 15:51:29,179 ERROR [com.cobim.cobimproj.exception.GlobalExceptionHandler] handleException: {} org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: Infinite recursion (StackOverflowError); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Infinite recursion (StackOverflowError) (through reference chain: owError) (thro..

[error react] React Hook "useState" is called conditionally. React Hooks must be called in the exact same order in every component render
error 2024. 11. 13. 12:21

에러 : React Hook "useState" is called conditionally. React Hooks must be called in the exact same order in every component render # 원인 react에선 hook 앞에 hook이 아닌 함수들 존재할시 나타나는 에러. # React Hook 이란 :React에서 상태(state)와 생명주기(lifecycle) 같은 기능을 함수형 컴포넌트에서 사용할 수 있게 해주는 함수입니다. 예전에는 상태나 생명주기 같은 기능을 클래스형 컴포넌트에서만 사용할 수 있었는데, React Hooks를 사용하면 함수형 컴포넌트에서도 이러한 기능을 손쉽게 사용할 수 있습니다. # 해결 ex) if (!card) return Load..

[Error]Content type 'application/octet-stream' not supported
error 2024. 11. 11. 11:57

[error]spring controller에서 file upload 해서 db에 저장할때, Content type 'application/octet-stream' not supported 같은 에러가 나올때 해결하는 방법. [해결]import com.fasterxml.jackson.databind.ObjectMapper;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.http.MediaType;import org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter;import org.springframework.st..