Skip to main content

Using Konami JS with React.

You'll want to import Konami JS in your main App component and initialize it when the component mounts.

The import part is pretty straight-forward and should appear at the top of your file like this:

import Konami from "konami";

The last step is initializing Konami JS when the component mounts. In most hook-based React apps this will require using useEffect and look something like this:

  useEffect(()=>{
const easterEgg = new Konami("https://konamijs.mand.is");
},[])

That's it!

Here is a React-based project on Glitch you can remix, already up-and-running with Konami JS:

https://konami-js-react.glitch.me