Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
react-storage-kit
Advanced tools
npm install --save react-storage-kit
or
yarn add react-storage-kit
import React, { useState } from 'react'
import { useStorageKit } from 'react-storage-kit'
// inside your function component
const storage = useStorageKit()
Return all value in Storage Kit
import React, { useState } from 'react'
import { useStorageKit } from 'react-storage-kit'
const MyComponent = () => {
const storage = useStorageKit()
const data = storage.getAll()
return (
<div>
<span>{data.fullName}</span>
</div>
)
}
export default MyComponent;
string[]
)Return multiple value in Storage Kit
import React, { useState } from 'react'
import { useStorageKit } from 'react-storage-kit'
const MyComponent = () => {
const storage = useStorageKit()
const data = storage.getMultiple(["fullName", "email", "age"])
console.log(data.fullName) // John Doe
console.log(data.phoneNumber) // undefined
return (
<div>
<span>{data.fullName}</span>
<span>{data.email}</span>
<span>{data.age}</span>
</div>
)
}
export default MyComponent;
key: string
,value: object | string | number
)Set key value StorageKit
import React, { useState } from 'react'
import { useStorageKit } from 'react-storage-kit'
const MyComponent = () => {
const storage = useStorageKit()
const handleClearAll = () => {
storage.setItem("fullName", "John Doe")
}
return (
<div>
<button onClick={handleClearAll}>Set item</button>
</div>
)
}
export default MyComponent;
key: string
)Delete a value in StorageKit
import React, { useState } from 'react'
import { useStorageKit } from 'react-storage-kit'
const MyComponent = () => {
const storage = useStorageKit()
const handleSetItem = () => {
storage.removeItem("fullName")
}
return (
<div>
<button onClick={handleDeleteItem}>Delete item</button>
</div>
)
}
export default MyComponent;
delete all values stored in StorageKit
import React, { useState } from 'react'
import { useStorageKit } from 'react-storage-kit'
const MyComponent = () => {
const storage = useStorageKit()
const handleClearAll = () => {
storage.clear()
}
return (
<div>
<button onClick={handleClearAll}>Clear All</button>
</div>
)
}
export default MyComponent;
MIT © l1ttps
FAQs
Local storage encryption Library for React Js
We found that react-storage-kit demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.