I have a problem where I always get my function changePage
undefined or not a function error on the chilled component!
parent
export default function App() {
const [page, setPage] = React.useState("Dashboard");
const changePage = (page) => {
setPage(page);
}
return (
<>
<MainPage setPageHook={changePage}/>
</>
)
}
child
export default function App( {props}) {
return (
<p onClick={() => props.changePage("Dashboard") </p>
)
}
why I'm getting this error ?
I'm expecting to use the function on the child component but it's not passing!
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744678654a4587481.html
评论列表(0条)