1.0.1 • Published 7 years ago
react-konami-hook v1.0.1
React Konami Hook 👾
React hook for adding the Konami code to your app
Note: This is using the new React Hooks API Proposal which is subject to change until React 16.7 final.
You'll need to install
react,react-dom, etc at^16.7.0-alpha.2
Install
yarn add react-konami-hookor
npm install --save react-konami-hookUsage
Just put a callback function into the hook for when the Konami Code is entered. Simple as that!
import useKonami from "react-konami-hook";
function App() {
useKonami(() => alert("Nice Job!"));
return (
<div
style={{
width: "100%",
height: "100%",
display: "flex",
alignItems: "center",
justifyContent: "center"
}}
>
<h1 style={{ fontFamily: "sans-serif" }}>Use the Konami Code</h1>
</div>
);
}Then ⬆️⬆️⬇️⬇️⬅➡⬅️➡️BA
Example
In the project folder:
yarn
yarn exampleor
npm install
npm run exampleContributors
Thanks goes to these wonderful people (emoji key):
| Alex💻 |
|---|
This project follows the all-contributors specification. Contributions of any kind welcome!