React renderToString没有data-react-checksum

时间:2018-05-26 17:54:31

标签: reactjs checksum ssr render-to-string

    // renderToString
try {
    initView = renderToString(
        <Provider store={store}>
            <StaticRouter location={location} context={context}>
                {renderRoutes(routes)}
            </StaticRouter>
        </Provider>
    );
    console.log('lzr======');
    console.log(initView);
    console.log('lzr======');
}

运行它,得到如下的initView:

<div data-reactroot=""><div></div><div><div class="common-side-bar"><a href="/"><div class="bar-top"></div></a><div class="pandect"><span class="icon-pandest"></span>some thing</div><div class="menu"><ul style="width:180px" class="ant-menu ant-menu-inline ant-menu-dark ant-menu-root" role="menu" aria-activedescendant="" tabindex="0"><li class="ant-menu-submenu-inline ant-menu-submenu"><div style="padding-left:24px" class="ant-menu-submenu-title" aria-expanded="false" aria-owns="iot$Menu" aria-haspopup="true"><span><i class="icon-iothub common-icon">....

我做了initView.indexOf(&#39;检查&#39;)并获得-1。任何人都可以给我一个帮助,谢谢。

1 个答案:

答案 0 :(得分:0)

我发现这个pullrequest删除了data-reactid和data-react-checksum。