wherehows / factory

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Factory

Factory is a collection of functions include helper and hooks that i made.

Hooks

  1. useIsDirty

Monitor a state if it has been changed from it's original value or not. it can be used to display an alert modal that warns the user that any unsaved changes will be lost if they leave the page.

  1. useBackspace

Set global states related to a backspace navigation

Helpers

  1. shouldNotForwardProp

Create an object to use as the second parameter for the styled function in Emotion.

const StyledComponent = styled('div', shouldNotForwardProp('isOn', 'isVisible'))(({ isOn, isVisible }) => ({
  backgroundColor: isOn ? 'black' : 'none',
  visibility: isVisible ? 'visible' : 'hidden'
}))

About


Languages

Language:TypeScript 54.4%Language:CSS 43.2%Language:JavaScript 2.4%