@emoji-captcha/react
v1.0.4
Published
Easily integrate emoji captcha in your react apps
Downloads
7
Readme
Emoji Captcha react client library
Easily integrate emoji captcha in your react apps
React Client Installation
Install emoji-captcha with npm
npm install @emoji-captcha/react
Install emoji-captcha with yarn
yarn add @emoji-captcha/react
Usage
Somewhere in your forms
import EmojiCaptcha from "@emoji-captcha/react";
const emojiRes = fetch("somewhere from the earth/emoji-captcha");
// if you are using SSR you can directly put the emoji captcha res
const App = () => {
const [selectedIdx, setSelectedIdx] = (useState < number) | (null > null);
return (
<div>
<h2>Emoji captcha React component demo</h2>
<EmojiCaptcha
onSelect={(val) => setSelectedIdx(val)}
emojis={emojiRes.emojis}
question={emojiRes.question}
questionPrefix="Select"
/>
<h3>You selected {selectedIdx}</h3>
</div>
);
};
export default App;