react-magic
react-magic copied to clipboard
Bigints larger than the browser is able to handle (e.g. Twitter widget ID's)
HTML attributes with big integers are converted to javascript integer.
<a class="twitter-timeline" data-widget-id="403673174782406656" data-theme="dark" data-link-color="#f96e5b" data-border-color="#e8e8e8" data-tweet-limit="3" width="225" height="400" lang="EN">My Tweets</a>
<a className="twitter-timeline" data-widget-id={403673174782406656} data-theme="dark" data-link-color="#f96e5b" data-border-color="#e8e8e8" data-tweet-limit={3} width={225} height={400} lang="EN">My Tweets</a>
http://facebook.github.io/react/html-jsx.html
This causes problems as Javascript is able to handle integers up to +/- 9007199254740991.
Numbers in Javascript are 64-bit floating point values, the largest exact integral value is 253-1, or 9007199254740991. In ES6, this is defined as Number.MAX_SAFE_INTEGER. http://stackoverflow.com/a/307200/5834249
Good catch, thanks. We've actually encountered similar issues at Facebook as our IDs are also 64-bit integers.