@volvo-cars/react-utils
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

React Utils

Questions? Ask in Slack #vcc-ui

@volvo-cars/react-utils

This package exposes useful generic hooks that don't belong to a hook collection (like react-layout-utils)

Installation

💡 This package includes Typescript definitions


usePrevious

Returns the previous value of a passed prop or state.

Name Description Type Default Value
value The property you wish to know the previous state of post re-render unknown undefined

useKeyPress

Adds an event listener on component mount that invokes the provided callback function on matching key(s)press.

useKeyPress('Escape', () => console.log('Escape key pressed!')
Name Description Type Default Value
keysToListenTo Comma or space delimited list of keys to listen to string undefined
callback Function to be invoked on keypress func undefined

Readme

Keywords

none

Package Sidebar

Install

npm i @volvo-cars/react-utils

Weekly Downloads

2,003

Version

1.0.2

License

UNLICENSED

Unpacked Size

11.5 kB

Total Files

10

Last publish

Collaborators

  • sylvainestevezvolvocars
  • allenbargi-vcc
  • jacobrask
  • glenashley
  • volvocars-uip-bot
  • alizeait
  • kristiankalb
  • samny_volvocars