Skip to content

mate-academy/react_keyboard

Repository files navigation

React Keyboard

React + Typescript cheat sheet

Make the App a class component with pressedKey in the state.

Here is the working version

  • before any key was pressed show the Nothing was pressed yet message;
  • when a key is pressed show a The last pressed key is [key] message;
  • use componentDidMount to add keyup handler:
    // DON'T import KeyboardEvent from React, because it is a regular event
    document.addEventListener('keyup', (event: KeyboardEvent) => {
      console.log(event.key);
    });
  • use removeEventListener to remove a global handler in componentWillUnmount.

Instructions

  • Install Prettier Extention and use this VSCode settings to enable format on save.
  • Implement a solution following the React task guideline.
  • Use the React TypeScript cheat sheet.
  • Open one more terminal and run tests with npm test to ensure your solution is correct.
  • Replace <your_account> with your Github username in the DEMO LINK and add it to the PR description.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •