Skip to content
Advertisement

Not able to open react-bootstrap modal from child component using react hooks to setState

I’m trying to trigger my react-bootstrap modal which is in the parent component from a button inside the child component. To achieve this, I am passing the handleShow function into the child component as props but this doesn’t seem to be working. The modal doesn’t open up on clicking the button and there are no errors on the browser console.

Parent Component:

OnboardPage.jsx

JavaScript

Child Component:

PersonalDetails.jsx

JavaScript

Can’t seem to trace why this isn’t working.

Advertisement

Answer

Turns out the styled component of <EditBtn> was missing {…props}. It hence wasn’t passing the onClick prop to the click listener. Thanks for your replies.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement