DEV Community

Discussion on: How to pass methods to Child components in React

Collapse
 
asaduzzaman69 profile image
Asaduzzaman Himel

I have been facing some issues in functional compoent. For example I have a component which recive children.

return (
    <Portal isOpen={isOpen}>
        {
            isOpen ? (
                <ModalContainer>
                    {children}
                </ModalContainer>

            ) : null
        }
    </Portal>
)
Enter fullscreen mode Exit fullscreen mode

Now I wanna pass a function to this children {children}. Could u tell me how to do this!?

Collapse
 
thecoollearner profile image
Alok Kumar

Can you please ping me in twitter, and then we can look into the problem ???

Here's my handle - @thecoollearner