I have two components for ex. <A/> and </B> and additionally <div id='test'>.
After pressing the button ,,A1",i want insert the content of component <A/> into and after pressing the button ,,B1" i want insert the content of component into the <div id='test'>
Very important: After pressing buttons the previous value in <div id='test'> must be deleted and replaced with the new value.
How can i do it?
Best regards, Łukasz
I tried this, but the commands not delete previous value.
ReactDOM.createPortal(<A />, document.getElementById('test'));
ReactDOM.createPortal(<B />, document.getElementById('test'));