Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

use-session-storage-state

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-session-storage-state - npm Package Compare versions

Comparing version 18.1.0 to 18.1.1

4

package.json
{
"name": "use-session-storage-state",
"version": "18.1.0",
"version": "18.1.1",
"description": "React hook that persist data in sessionStorage",

@@ -12,3 +12,3 @@ "license": "MIT",

"email": "hello@astoilkov.com",
"url": "http://astoilkov.com"
"url": "https://astoilkov.com"
},

@@ -15,0 +15,0 @@ "keywords": [

@@ -8,3 +8,3 @@ # `use-session-storage-state`

[![Test Coverage](https://img.shields.io/codeclimate/coverage/astoilkov/use-session-storage-state)](https://codeclimate.com/github/astoilkov/use-session-storage-state/test_coverage)
[![Build Status](https://img.shields.io/github/workflow/status/astoilkov/use-session-storage-state/CI)](https://github.com/astoilkov/use-session-storage-state/actions/workflows/main.yml)
[![Build Status](https://img.shields.io/github/actions/workflow/status/astoilkov/use-session-storage-state/main.yml?branch=main)](https://github.com/astoilkov/use-session-storage-state/actions/workflows/main.yml)

@@ -39,3 +39,2 @@ ## Install

const [todos, setTodos] = useSessionStorageState('todos', {
ssr: true,
defaultValue: ['buy avocado', 'do 50 push-ups']

@@ -50,3 +49,3 @@ })

You can experiment with the example [here](https://codesandbox.io/s/todos-example-use-session-storage-state-pewbql?file=/src/App.tsx).
You can experiment with the example [here](https://codesandbox.io/s/todos-example-use-session-storage-state-3s4hhe).

@@ -59,3 +58,2 @@ ```tsx

const [todos, setTodos] = useSessionStorageState('todos', {
ssr: true,
defaultValue: ['buy avocado']

@@ -86,3 +84,3 @@ })

<details>
<summary id="is-persistent">Notify the user when <code>sessionStorage</code> isn't saving the data using the <code>`isPersistent`</code> property</summary>
<summary id="is-persistent">Notify the user when <code>sessionStorage</code> isn't saving the data using the <code>isPersistent</code> property</summary>
<p></p>

@@ -135,2 +133,19 @@

<details>
<summary>Why does my component re-renders twice?</summary>
<p></p>
If you are hydrating your component (for example, if you are using Next.js), your component might re-render twice. This is behavior specific to React and not to this library. It's caused by the `useSyncExternalStore()` hook. There is no workaround. This has been discussed in the issues: https://github.com/astoilkov/use-local-storage-state/issues/56.
If you want to know if you are currently rendering the server value you can use this helper function:
```ts
function useIsServerRender() {
return useSyncExternalStore(() => {
return () => {}
}, () => false, () => true)
}
```
</details>
## API

@@ -137,0 +152,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc