在服务器端渲染进行水合作用时更改数据反应根的位置

时间:2019-06-20 14:59:40

标签: reactjs ssr react-server

我想在React中用标签等渲染整个页面,因为那里有很多逻辑。但是React会在顶部元素(contour_points[] #list of contour points lower_line_point_list[] #list of points belonging to the lower red line #get list of sets where each set is formed by points have the same x-coordinate set_by_x = form_sets_by_x_coordinate(contour_points) for set in set_by_x: if len(set) == 2: p = lower_point_in_set(set) lower_line_point_list.append(p) clean_up(lower_line_point_list) #check for 4-connectivity )上自动添加data-reactroot属性

例如<html data-reactroot="">组件将包含:

RootPage

该组件只能在服务器端呈现,而在客户端,我只想从 <html> <body> <div id="react-root"> ..... 中吸取水分。

我可以使用<div id="react-root">并手动添加标签renderToStaticMarkup,但这似乎有点不足,如果在将来的版本中React将添加更多此类属性,则会立即中断补液。

0 个答案:

没有答案