Warning: React attempted to reuse markup in a container but the checksum was invalid issue
johnbrett opened this issue · 1 comments
johnbrett commented
HI,
Thanks for this module first of all, new to react, it's helping me organise CSS quite well. Running into the following issue building a Universal (isomorphoc) js app though, I'm getting the following warning when I add InlineCss to a component:
Warning: React attempted to reuse markup in a container but the checksum was invalid.
This generally means that you are using server rendering and the markup generated on
the server was not what the client was expecting. React injected new markup to
compensate which works but you have lost many of the benefits of server rendering.
Instead, figure out why the markup being generated is different on the client or server:
(client) ><div id="InlineCss-0" data-reactid=".p7
(server) ><div id="InlineCss-1" data-reactid=".p7
I've narrowed it down to adding InlineCSS to the following render method:
render() {
const listNumber = this.props.listNumber;
return (
<InlineCss stylesheet={TextInput.css()}>
<div>
<span className="list-number">{listNumber}.</span>
<div className="question">{this.props.label} {this.props.required ? '*' : ''}</div>
<input type="text" />
</div>
</InlineCss>
);
}
Have you any advice on debugging this? Is there a problem with using InlineCss on nested components or repeated components ?
RickWong commented
Do you still have this issue? Seems like the number of <InlineCss />
usages differs, or the sort order differs.
The best way to solve this is to pass a unique namespace
prop like <InlineCss namespace="list" />
.