Skip to content

Commit

Permalink
feat: use hydrate for prerender
Browse files Browse the repository at this point in the history
  • Loading branch information
leonwgc committed Apr 25, 2024
1 parent 524e0ac commit fa565d6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions demo/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import React from 'react';
import { render } from 'react-dom';
import { render, hydrate } from 'react-dom';
import App from './App';
import './App.less';

render(<App />, document.querySelector('#root') as HTMLElement);
const root = document.querySelector('#root') as HTMLElement;
const doRender = root.hasChildNodes() ? hydrate : render;

doRender(<App />, root);
Loading

0 comments on commit fa565d6

Please sign in to comment.