Issue
I am quite new to ReactJS and I am trying to make a Trello Clone. I have linked my GitHub page with my code below since its to much to put on here.
My problem is I am receiving the error "Uncaught TypeError: this.props.parentCallback2 is not a function
" when trying to pass data back to the parent from the child component.
I have tried re-writing the code multiple ways and Googling around to try and find a answer but no luck. My end goal is to make it so that when you click on an item, it makes the "<ModifyModal />
" appear on the screen.
Below is my code:
App.js file Toolbox.jsx file Item.jsx file
Any help would be appreciated even simplifying my code. :)
Solution
<Widget>
element receives the parentCallback2
prop:
<Widget key={i} parentCallback2={this.handleCallback}/>
But it doesn't then pass it forward to <Todobox>
here const Widget = () => <Todobox />;
so when <Todobox>
tries to invoke parentCallback2
it throws the error since it's undefined
const Widget = ({parentCallback2}) => <Todobox parentCallback2={parentCallback2}/>
Answered By - T J
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.