리액트로 시간을 표시하는 간단한 연습 중 아래와 같은 오류가 발생함
Uncaught TypeError: react_dom_clientWEBPACK_IMPORTED_MODULE_1.render is not a function
리액트 18버전에서는 ReactDom.render를 더 이상 사용하지 않기 때문에
Dom 노드의 내부에 element를 저장할 root를 만드는 createRoot 메소드를 사용해 변수를 미리 만들어두고
root.render방식으로 사용해야 한다.
이를 적용하여 아래와 같이 변경해주었다.
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<Clock />
</React.StrictMode>,
document.getElementById('root')
);
*root.unmount : 루트 내부에 랜더링된 트리를 파괴