-
카테고리
-
세부 분야
풀스택
-
해결 여부
미해결
useeffect
20.09.03 13:19 작성 조회수 129
0
product image 컴포넌트에서 use effect 안쓰고
안의 문법은 그대로 쓰면 안되나요? use effect를 안쓰고도
뭔가 안의 문법만으로 구현가능하지 않나 라는 생각에
여쭤봅니다,,
답변을 작성해보세요.
0
0
John Ahn
지식공유자2020.09.05
useEffect(() => {
if (props.detail.images && props.detail.images.length > 0) {
let images = []
props.detail.images.map(item => {
images.push({
original: `http://localhost:5000/${item}`,
thumbnail: `http://localhost:5000/${item}`
})
})
setImages(images)
}
}, [props.detail])
이 부분을 말씀하시는 건가요 ?
답변 2