What's the difference between hydrate() and render() in React 16?

后端 未结 6 834
我寻月下人不归
我寻月下人不归 2021-01-30 05:53

I\'ve read the documentation, but I didn\'t really understand the difference between hydrate() and render() in React 16.

I know hydrate()

6条回答
  •  鱼传尺愫
    2021-01-30 06:38

    render will flush out anything in the specified element(named as 'root' in most cases) and rebuild it ,while hydrate will keep anything that is already inside the specified element and build from that,making the initial page load faster.

提交回复
热议问题