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
shm91
shm912y ago
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
mid
mid2y ago
Change to return( <>
<div className="RequestNewOrgBtn"> <Button disabled={false} onClick={onAddClick}> { "Request New External org" } </Button> <RequestExternalOrgModal isOpen={ShowReqExOrgModal} onClose={onReqExOrgModalClose} /> </div>
</> ); Remove { } @shm99
shm91
shm912y ago
I have removed but thats not helping
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server