react-use-konami
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

react-use-konami Build Status

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;

Dependents (2)

Package Sidebar

Install

npm i react-use-konami

Weekly Downloads

1,020

Version

1.1.0

License

MIT

Unpacked Size

9.06 kB

Total Files

19

Last publish

Collaborators

  • moldy530