Skip to content

Why is renderToString(<div/>) generating different id's and checksums on each call? Is this a defect? #3300

@jeffbski

Description

@jeffbski

I was trying to figure out why my isomorphic rendering isn't matching and thus I began trying to simply code when I realized that even successive rendering of a single div ends up with different checksums and id's??

Can anyone help me understand this?

var React = require('react');
var elem = React.createElement("div", null);
console.log(React.renderToString(elem)); // '<div data-reactid=".2c9xyqo6uio" data-react-checksum="220400958"></div>'
console.log(React.renderToString(elem)); // '<div data-reactid=".27gjxlu5fk" data-react-checksum="-46789451"></div>'

var assert = require('assert');
assert(React.renderToString(elem) === React.renderToString(elem)); // fails

I expected the checksums to be the same and probably the event id's (but I don't know how it determines those).

Does this appear to be a defect?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions