How to use the @rehooks/local-storage.useLocalStorage function in @rehooks/local-storage

To help you get started, we’ve selected a few @rehooks/local-storage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hubtype / botonic / packages / botonic-react / src / webchat / webchat.jsx View on Github external
updateTyping,
    updateWebview,
    updateSession,
    updateUser,
    updateLastRoutePath,
    updateHandoff,
    updateTheme,
    updateDevSettings,
    toggleWebchat,
    setError,
    openWebviewT,
    closeWebviewT,
  } = props.webchatHooks || useWebchat()
  const { theme } = webchatState
  const { initialSession, initialDevSettings, onStateChange } = props
  const [botonicState, saveState, deleteState] = useLocalStorage('botonicState')
  const [persistentMenuOpened, setPersistentMenuOpened] = useState(false)
  const [emojiPickerOpened, setEmojiPickerOpened] = useState(false)
  const [attachment, setAttachment] = useState({})

  const getThemeProperty = _getThemeProperty(theme)

  const handleAttachment = event => {
    setAttachment({
      fileName: event.target.files[0].name,
      file: event.target.files[0], // TODO: Attach more files?
      attachmentType: getAttachmentType(event.target.files[0].type),
    })
  }

  useEffect(() => {
    sendAttachment(attachment)
github strvcom / dep-manager-web / src / containers / AuthenticatedQuery / index.tsx View on Github external
function AuthenticatedQuery(props: QueryProps) {
  const [token] = useLocalStorage(GITHUB_TOKEN_KEY)
  const skip = props.skip || !token
  const context = { token, ...props.context }

  return  {...props} skip={skip} context={context} />
}

@rehooks/local-storage

React hook for local-storage

MIT
Latest version published 1 year ago

Package Health Score

60 / 100
Full package analysis