score:1

Accepted answer

The issue seems to be in the map function. You are not returning anything from the function.

Return properly and it should work fine.

{this.state.boxes.map((box,index)=>{
    return ReactDOM.createPortal(  //Return here
        box,
        document.getElementById("portal"+(this.state.boxes.length-index).toString())
    )
)}

Hope it helps. Revert for any doubts/clarifications.


Related Query

More Query from same tag