Rendering Emojis With Unicodes in Javascript
Ordinarily you can render an emoji in Javascript by using its four-character Unicode code point as follows:
(React JS [JSX] Sample)
<span>{'\u263B'}</span> => <span>☻</span>
Sometimes, however, the Unicode code point for an emoji is more than four characters long and the above method for rendering doesn't work. In ECMA6, the following syntax will work for emojis whose Unicode code point length is more than four (1):
<span>{'\u{1F4A9}'}</span> => <span>💩</span>
Note:
- This has only been tested with a five-character Unicode code point.