Closed puradox closed 8 years ago
After some digging, I've found that this seemingly random number is actually random, thanks to Math.floor(Math.random() * 0xFFFF)
from here.
Is it really wise to generate a random number for a React id? I would understand if there was a way to specify a seed for the random generator, but JavaScript's Math.random()
:
selects the initial seed to the random number generation algorithm; it cannot be chosen or reset by the user - MDN
Doesn't this introduce problems to server rendering?
Problem description
The
TextField
inputId
is differing between client and server. This is causing React to inject the client-side version of theTextField
, resulting in the lose of isomorphic benefits.I don't believe this to be a
userAgent
issue since the style is not being affected. I also don't believe this to be aNODE_ENV
issue since both webpack and the server haveNODE_ENV=development
prefixed to their execution inpackage.json
.Warning
Resulting HTML
Versions