Cộng đồng Hỏi & Đáp của Inflearn
useeffect
Viết
·
226
0
product image 컴포넌트에서 use effect 안쓰고
안의 문법은 그대로 쓰면 안되나요? use effect를 안쓰고도
뭔가 안의 문법만으로 구현가능하지 않나 라는 생각에
여쭤봅니다,,
웹앱nodejsreduxreactmongodb
Câu trả lời 2
0
0
John Ahn
Người chia sẻ kiến thức
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])
이 부분을 말씀하시는 건가요 ?





