강의

멘토링

커뮤니티

Inflearn Community Q&A

sundays9947's profile image
sundays9947

asked

Learn by Following Along Node, React Series - Building a Shopping Mall Site [Complete Renewal]

useeffect

Written on

·

230

0

product image 컴포넌트에서 use effect 안쓰고

안의 문법은 그대로 쓰면 안되나요? use effect를 안쓰고도

뭔가 안의 문법만으로 구현가능하지 않나 라는 생각에

여쭤봅니다,,

웹앱nodejsreduxreactmongodb

Answer 2

0

sundays9947님의 프로필 이미지
sundays9947
Questioner

네 맞습니다!

0

John Ahn님의 프로필 이미지
John Ahn
Instructor

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])

이 부분을 말씀하시는 건가요 ? 

sundays9947's profile image
sundays9947

asked

Ask a question