Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/alexanderson1993/react-konami-hook

A hook for reacting to the Konami Code
https://github.com/alexanderson1993/react-konami-hook

Last synced: 2 months ago
JSON representation

A hook for reacting to the Konami Code

Awesome Lists containing this project

README

        

# `React Konami Hook` 👾

[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors)

> React hook for adding the Konami code to your app

> **Note:** This is using the new
> [React Hooks API Proposal](https://reactjs.org/docs/hooks-intro.html) 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`

[![Edit useKonami hook](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/6v25x8pyyn)

## Install

```sh
yarn add react-konami-hook
```

or

```sh
npm install --save react-konami-hook
```

## Usage

Just put a callback function into the hook for when the Konami Code is entered.
Simple as that!

```js
import useKonami from "react-konami-hook";

function App() {
useKonami(() => alert("Nice Job!"));
return (


Use the Konami Code



);
}
```

Then `⬆️⬆️⬇️⬇️⬅➡⬅️➡️BA`

## Example

In the project folder:

```sh
yarn
yarn example
```

or

```sh
npm install
npm run example
```

## Contributors

Thanks goes to these wonderful people
([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):

| [
Alex](https://ralexanderson.com)
[💻](https://github.com/alexanderson1993/react-konami-hook/commits?author=alexanderson1993 "Code") |
| :---: |

This project follows the
[all-contributors](https://github.com/kentcdodds/all-contributors)
specification. Contributions of any kind welcome!