简体   繁体   中英

how to call a function from parent-sibling to child component in react-hooks

在此处输入图像描述

Here I have a situation need best help to solve it, i need to solve this by using react-Hooks. I am a newbie and need help!!!!


There's a parent component who has 2 child component ( child-1 and child-2) . child-2 has 2 grandchilds ( gdc-1 and gdc-2 ). Now, I want to pass an arrow function from child-1 to gdc-2 . i basically want to pass a value through that function. how to do that?

define the function and state in parent and then pass it to child 1 and to gdc-2 via child 2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM