Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
react-persist-with-session
Advanced tools
Persist and rehydrate React state to localStorage.
npm install react-persist --save
Just import the <Persist >
component and pass it the data you want it to persist. It renders null
, so it can go wherever you need it to....
import React from 'react'
import { Persist } from 'react-persist'
class Signup extends React.Component {
state = {
firstName: '',
lastName: '',
email: '',
isLoading: false,
error: null
};
// ...
render() {
return (
<form onSubmit={this.handleSubmit}>
{/* whatever....*/}
<Persist
name="signup-form"
data={this.state}
debounce={500}
onMount={data => this.setState(data)}
/>
</form>
)
}
}
Only a few of them!
name: string
: LocalStorage key to save form state todata: any
: Data to persistdebounce:? number
: Number of ms to debounce the function that saves form state. Default is 300
.onMount: (data: any) => void
: (optionally) Hydrate your data (into React state). Will only be called if data is not null
.useSessionStorage?: boolean
: Use sessionStorage
instead of localStorage
. Default is false
.FAQs
Persist and rehydrate React state
The npm package react-persist-with-session receives a total of 0 weekly downloads. As such, react-persist-with-session popularity was classified as not popular.
We found that react-persist-with-session 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.