1.0.2 • Published 5 years ago

@timeyurah/handle-key-press v1.0.2

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
5 years ago

@timeyurah/handle-key-press

npm (scoped)

Objetivo

Checar qual tecla foi digitada pelo usuário. Caso a tecla seja a escolhida, executar uma função.

Instalação

npm install @timeyurah/handle-key-press

Uso

Em um ambiente React:

import React, { Component } from 'react;
import handleKeyPress from '@timeyurah/handle-key-press';

class Test extends Component {
  testFunction = () => {
    console.log('It worked!')
  }

  render = () =>
    <form>
      <input type='text' onKeyPress={ e => handleKeyPress(e, 'Enter', this.testFunction) } />
    </form>
}

export default Test;
1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago