react-use-konami
v1.1.0
Published
react hook that adds konami code to your component
Downloads
11,526
Maintainers
Readme
react-use-konami
React custom hook to add easter egg functionality to your React components.
Installation
npm install --save react-use-konami
Usage
import React from 'react';
import useKonami from 'react-use-konami';
const MyComponent = () => {
/**
* takes two parameters:
* handler: () => any
* options?: {code: string[]}
*
* the default code is:
* ['ArrowUp', 'ArrowUp', 'ArrowDown', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'ArrowLeft', 'ArrowRight', 'b', 'a', 'Enter']
*/
useKonami(() => {
console.log('hi easter egg!');
}, {
code: ['ArrowUp', 'ArrowDown', 'Enter'],
});
return <div> Hi World </div>;
}
export default MyComponent;