Inflearn コミュニティ Q&A
useeffect
作成
·
226
0
product image 컴포넌트에서 use effect 안쓰고
안의 문법은 그대로 쓰면 안되나요? use effect를 안쓰고도
뭔가 안의 문법만으로 구현가능하지 않나 라는 생각에
여쭤봅니다,,
웹앱nodejsreduxreactmongodb
回答 2
0
0
John Ahn
インストラクター
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])
이 부분을 말씀하시는 건가요 ?





