DEV Community

Discussion on: Understand One-way Data Binding in React the easy way!

Collapse
permanar profile image
Richie Permana

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)}>
Enter fullscreen mode Exit fullscreen mode

CMIIW.

Thread Thread
parnikagupta profile image
Parnika-Gupta Author

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?