Skip to content

Commit 23a2cad

Browse files
committed
docs: use hydrateRoot in SSR demo
1 parent 7362270 commit 23a2cad

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

docs/examples/ssr.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { clsx } from 'clsx';
22
import CSSMotion, { genCSSMotion } from 'rc-motion';
33
import React from 'react';
4-
import { hydrate } from 'react-dom';
4+
import { hydrateRoot } from 'react-dom/client';
55
import ReactDOMServer from 'react-dom/server';
66
import './basic.less';
77

@@ -44,9 +44,10 @@ const App = () => {
4444
document.body.appendChild(div);
4545
div.innerHTML = ssr;
4646

47-
hydrate(<MotionAppear supportMotion />, div);
47+
const root = hydrateRoot(div, <MotionAppear supportMotion />);
4848

4949
return () => {
50+
root.unmount();
5051
document.body.removeChild(div);
5152
};
5253
}, []);

0 commit comments

Comments
 (0)