A dead simple React Twemoji component.
npm install --save twemoji
# or
yarn add twemoji
A dead simple React Twemoji component.
npm install --save twemoji
# or
yarn add twemoji
import React from 'react' | |
import Twemoji from './Twemoji' | |
const Example = () => ( | |
<p> | |
Hello! <Twemoji emoji="👋" /> | |
</p> | |
) | |
export default Example |
.emoji { | |
display: inline-block; | |
width: auto; | |
height: 1em; | |
vertical-align: -0.125em; | |
} |
import React, { memo } from 'react' | |
import twemoji from 'twemoji' | |
const Twemoji = ({ emoji }) => ( | |
<span | |
dangerouslySetInnerHTML={{ | |
__html: twemoji.parse(emoji, { | |
folder: 'svg', | |
ext: '.svg' | |
}) | |
}} | |
/> | |
) | |
export default memo(Twemoji) |
UPDATE