Hey there is no particular reason I did that. Is there a reason why we should or shouldn't be using arrow functions when we can directly pass the setText function? I would love to learn more about the depth of it.
IMHO, its just matter of simplicity and consistency.
<Child setText={ setText }>
// is the same as
<Child setText={(text) => { setText(text) }}>
// but not as
<Child setText={ setText() }>
//or
<Child setText={(text) => setText(text)}>
I just saw a video on callbacks that made it clear for me.. I will find it again to grab a link and share if anyone needs...But what's the difference between 2nd format and the 4th one that you have shared?
Hey there is no particular reason I did that. Is there a reason why we should or shouldn't be using arrow functions when we can directly pass the setText function? I would love to learn more about the depth of it.
IMHO, its just matter of simplicity and consistency.
CMIIW.
I just saw a video on callbacks that made it clear for me.. I will find it again to grab a link and share if anyone needs...But what's the difference between 2nd format and the 4th one that you have shared?
I’m not actually sure. I’ve just always done it like this, but I don’t really see any differences between the two methods