I'm trying to appendChild() on a div with React. I am pretty new to React so I'm not sure why this throws this error:
Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
This is the code - if someone can explain this that would help a ton.
import React from 'react'
import './global.css'
import TextCopy from './TextCopy/TextCopy'
import Title from './Title/Title'
export default function App() {
const renderTextCopy = (text) => {
document.getElementById("wrapper").appendChild(<TextCopy text={text} />)
}
return (
<>
<Title />
<button onClick={() => renderTextCopy("test")}>JAVA</button>
<div id="wrapper"></div>
</>
)
}