1.3.1 • Published 2 years ago

@paterm/library v1.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

React Library 🍋

Components

React If Conditions:

<If condition={true}>
  <Then>Awesome text</Then>
  <ElseIf>ElseIf awesome text</ElseIf>
  <Else>Else awesome text</Else>
</If>

Switch

<Switch expression='red' >
  <Case value='red'>
    Red
  </Case>
  <Case value='green'>
    Green
  </Case>
  <Case value='gray'>
    Gray
  </Case>
  <Default>
    Default
  </Default>
</Switch>

Portal

<Portal container={document.body}>
  {children}
</Portal>

Utils

Plural (declension of words)

Plural(5, ['лимон', 'лимона', 'лимонов']) // => 5 лимонов

DownloadBlob (downloading blob as file)

DownloadBlob(Blob, filename)

React Hooks

usePrev

const prevValue = usePrev(value)

useDebounce

const debouncedValue = useDebounce(value, delay = 600)