You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ReactModal component has a parentSelector that is meant to return an HTML node to attach to.
However I want to be able to create modal boxes that are related to a parent component or higher order component.
Is there a way to attach the modal box to a particular react component and somehow forward references from the parent component to the react modal component?
The text was updated successfully, but these errors were encountered:
But the above fails because I'm using stateless functional components, and I'm also using styled components. Then it tells me to use React.forwardedRef, but that doesn't seem to work with styled components, I end up with loads of type errors.
Variations of this including the usage of modalContainer.current or () => modalContainer.current all fail because it eventually complains that refs cannot be passed to the stateless functional components.
It seems the only solution is to pass some sort of unique id into the component for it to attach to.
Well I ended up with just using a unique id and using document.getElementById to attach it, couldn't find a way to use React references when I'm also using stateless functional components.
The
ReactModal
component has aparentSelector
that is meant to return an HTML node to attach to.However I want to be able to create modal boxes that are related to a parent component or higher order component.
Is there a way to attach the modal box to a particular react component and somehow forward references from the parent component to the react modal component?
The text was updated successfully, but these errors were encountered: