mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
cleanup
This commit is contained in:
parent
f327ec0e43
commit
673d0d1453
6
package-lock.json
generated
6
package-lock.json
generated
@ -33902,9 +33902,9 @@
|
||||
}
|
||||
},
|
||||
"web3modal": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/web3modal/-/web3modal-1.8.0.tgz",
|
||||
"integrity": "sha512-FsLZ3xnSK+jT22LCZz1M7Jibz/4e4Lf2wScKcNWKNJ4BzLWCp16Mmv6Hq4bgn5zOOqd3ADclH3TzS0l5DoCIKQ==",
|
||||
"version": "1.9.0",
|
||||
"resolved": "https://registry.npmjs.org/web3modal/-/web3modal-1.9.0.tgz",
|
||||
"integrity": "sha512-Lby0zGWBbdj+7ADlmtzNa3/RLnAMf2RMmNbrEXWkCZs8xZrVWNPkPcm7/RjmS/6FRStn29mhqTInjyHY6NJw+g==",
|
||||
"requires": {
|
||||
"detect-browser": "^5.1.0",
|
||||
"prop-types": "^15.7.2",
|
||||
|
@ -1,29 +0,0 @@
|
||||
import { isBrowser } from '../utils'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
function useStoredValue<T>(
|
||||
key: string,
|
||||
initialState: T
|
||||
): [T, (newValue: T) => void] {
|
||||
const [value, setValue] = useState<T>(initialState)
|
||||
|
||||
useEffect(() => {
|
||||
if (isBrowser) {
|
||||
const storedValue = localStorage.getItem(key)
|
||||
if (storedValue) {
|
||||
setValue(JSON.parse(storedValue) as T)
|
||||
}
|
||||
}
|
||||
}, [])
|
||||
|
||||
const updateValue = (newValue: T) => {
|
||||
if (isBrowser) {
|
||||
localStorage.setItem(key, JSON.stringify(newValue))
|
||||
}
|
||||
setValue(JSON.parse(JSON.stringify(newValue)))
|
||||
}
|
||||
|
||||
return [value, updateValue]
|
||||
}
|
||||
|
||||
export default useStoredValue
|
Loading…
Reference in New Issue
Block a user