Hello everyone, I need help, I stuck at rendering a component insider a div. My code is like below,
const labelItem = Array.from(document.querySelectorAll('label'))
.find(el => el.textContent === 'External Org Name');
const parentDiv = labelItem?.parentNode?.parentNode?.parentNode;
return(
<>
{
<div className="RequestNewOrgBtn">
<Button disabled={false} onClick={onAddClick}>
{ "Request New External org" }
</Button>
<RequestExternalOrgModal
isOpen={ShowReqExOrgModal}
onClose={onReqExOrgModalClose} />
</div>
}
</>
);
4 Replies
I have posted my question here too: https://stackoverflow.com/q/75356985/2183545
Stack Overflow
Rendering a div element inside existing div during page rendering
I'm stuck at rendering a component insider a div. My code is like below, I want to render the div with classname RequestNewOrgBtn inside the parentDiv. How can I do it at runtime of render?
const
Change to
return(
<>
<div className="RequestNewOrgBtn"> <Button disabled={false} onClick={onAddClick}> { "Request New External org" } </Button> <RequestExternalOrgModal isOpen={ShowReqExOrgModal} onClose={onReqExOrgModalClose} /> </div>
</> ); Remove { } @shm99
<div className="RequestNewOrgBtn"> <Button disabled={false} onClick={onAddClick}> { "Request New External org" } </Button> <RequestExternalOrgModal isOpen={ShowReqExOrgModal} onClose={onReqExOrgModalClose} /> </div>
</> ); Remove { } @shm99
I have removed but thats not helping
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View