"shouldComponentUpdate" 运行 在服务器上吗?

is "shouldComponentUpdate" run on the server?

在文档中找不到任何关于此的内容,我需要在不重新呈现子组件的情况下对父状态更改进行一些浏览器操作。我可以在 "shouldComponentUpdate" 中执行此操作并使其 return 为假,但只是想知道这对在服务器端呈现有什么影响?

如果您在服务器上使用 renderToString,则不会有任何影响,因为 renderToString 不会调用 shouldComponentUpdate来源: Slide deck - slide #10)

renderToString 将调用:

  • 获取初始状态
  • componentWillMount
  • 渲染

Sample server render - Sample client render