Last active
November 13, 2021 15:44
-
-
Save nolanlawson/fa60717eceb719b729e10d522c62c9ec to your computer and use it in GitHub Desktop.
emoji-picker-element React example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<title>emoji-picker-element React example</title> | |
</head> | |
<body> | |
<div></div> | |
<script type="module"> | |
import * as React from "https://cdn.skypack.dev/react@^17"; | |
import * as ReactDOM from "https://cdn.skypack.dev/react-dom@^17"; | |
import "https://cdn.skypack.dev/emoji-picker-element@^1"; | |
const Picker = () => { | |
const ref = React.useRef(null) | |
React.useEffect(() => { | |
ref.current.addEventListener('emoji-click', event => { | |
console.log('Emoji clicked!', event) | |
}) | |
ref.current.skinToneEmoji = '👍' | |
}, []) | |
return React.createElement('emoji-picker', { ref }) | |
} | |
ReactDOM.render(React.createElement(Picker), document.querySelector('div')) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment