React DOM APIs
react-dom 패키지는 웹 애플리케이션(브라우저 DOM 환경)에서만 지원되는 메서드를 포함합니다. React Native에서는 지원되지 않습니다.
API
아래 API는 컴포넌트에서 불러올 수 있습니다. 사용할 일은 거의 없습니다.
createPortal을 사용하면 자식 컴포넌트를 DOM 트리의 다른 부분에 렌더링 할 수 있습니다.flushSync를 사용하면 React가 State 업데이트를 수행하고 동기적으로 DOM을 업데이트하도록 강제할 수 있습니다.
Resource Preloading APIs
These APIs can be used to make apps faster by pre-loading resources such as scripts, stylesheets, and fonts as soon as you know you need them, for example before navigating to another page where the resources will be used.
React-based frameworks frequently handle resource loading for you, so you might not have to call these APIs yourself. Consult your framework’s documentation for details.
preconnectlets you connect to a server you expect to request resources from, even if you don’t know what resources you’ll need yet.prefetchDNSlets you prefetch the IP address of a DNS domain name that you expect to connect to.preinitlets you fetch and evaluate an external script or fetch and insert a stylesheet.preinitModulelets you fetch and evaluate an ESM module.preloadlets you fetch a stylesheet, font, image, or external script that you expect to use.preloadModulelets you fetch an ESM module that you expect to use.
진입점
react-dom 패키지는 두 개의 진입점Entry Points을 제공합니다.
react-dom/client는 React 컴포넌트를 클라이언트(브라우저)에 렌더링하는 API를 포함합니다.react-dom/server는 React 컴포넌트를 서버에 렌더링하는 API를 포함합니다.
제거된 API
아래 API는 React 19에서 제거되었습니다.
findDOMNode: see alternatives.hydrate: usehydrateRootinstead.render: usecreateRootinstead.unmountComponentAtNode: useroot.unmount()instead.renderToNodeStream: usereact-dom/serverAPIs instead.renderToStaticNodeStream: usereact-dom/serverAPIs instead.