강의

멘토링

커뮤니티

Inflearn Community Q&A

ianlee's profile image
ianlee

asked

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

TypeError: props.refreshFunction is not a function 오류

Written on

·

1.3K

0

function SearchMenu(props) {
const [SearchTerm, setSearchTerm] = useState("")
const searchHandler = (event) => {
setSearchTerm(event.currentTarget.value)
props.refreshFunction(event.currentTarget.value)
}

return (
<ul class="icon-container">
<li class="icon-item"><SearchOutlined style={{fontSize:'20px'}}/></li>
<li class="icon-item"><input class='searchBar' type='text' onChange={searchHandler} value={SearchTerm} style={{width:'80px', height:'20px'}}></input></li>
</ul>
)
}

위와 같이 코드를 작성하였는데 아래처럼 오류가 뜹니다..

어떻게 해결해야 될까요?

react웹앱reduxmongodbnodejs

Answer 2

0

proyong님의 프로필 이미지
proyong
Questioner

예 LandingPage에서 refreshFunction 함수를 내려주었지만 오류가 나네요..

<SearchMenu
refreshFunction={updateSearchTerm}
/>

0

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

안녕하세요 ! 

그 부모 컴포넌트에서 SearchMenu 자녀 컴포넌트에 해당 함수를 props로 내려주시지 않은것 같습니다 

LandingPage에서 

<div style={{ display: 'flex', justifyContent: 'flex-end', margin: '1rem auto' }}>
<SearchFeature
refreshFunction={updateSearchTerm}
/>
</div>

이런식으로 해주셨나요~? 

ianlee's profile image
ianlee

asked

Ask a question