
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@tanstack/react-query-persist-client
Advanced tools
React bindings to work with persisters in TanStack/react-query
@tanstack/react-query-persist-client is a package that provides utilities to persist and rehydrate the state of React Query across sessions. This can be useful for maintaining the state of your queries even after a page reload or when navigating away from the application.
Persisting Query State
This feature allows you to persist the state of your queries using local storage. The `persistQueryClient` function is used to set up the persistence, and `createWebStoragePersistor` is used to specify the storage mechanism.
import { persistQueryClient } from '@tanstack/react-query-persist-client';
import { createWebStoragePersistor } from '@tanstack/react-query-persist-client/web-storage';
const queryClient = new QueryClient();
const persistor = createWebStoragePersistor({ storage: window.localStorage });
persistQueryClient({ queryClient, persistor });
Rehydrating Query State
This feature allows you to rehydrate the state of your queries from the persisted storage. The `persistQueryClientRestore` function is used to restore the state, ensuring that your queries are in the same state as they were before the page reload or navigation.
import { persistQueryClientRestore } from '@tanstack/react-query-persist-client';
import { createWebStoragePersistor } from '@tanstack/react-query-persist-client/web-storage';
const queryClient = new QueryClient();
const persistor = createWebStoragePersistor({ storage: window.localStorage });
persistQueryClientRestore({ queryClient, persistor });
redux-persist is a library that allows you to persist and rehydrate a Redux store. It provides similar functionality to @tanstack/react-query-persist-client but is specific to Redux. It supports various storage engines and has a flexible configuration.
apollo-cache-persist is a library for persisting and rehydrating the Apollo Client cache. It provides similar functionality to @tanstack/react-query-persist-client but is specific to Apollo Client. It supports multiple storage options and is useful for maintaining the state of GraphQL queries.
react-query is a library for managing server state in React applications. While it does not provide built-in persistence, it can be extended with @tanstack/react-query-persist-client for persistence capabilities. It focuses on fetching, caching, and synchronizing server data.
FAQs
React bindings to work with persisters in TanStack/react-query
The npm package @tanstack/react-query-persist-client receives a total of 309,180 weekly downloads. As such, @tanstack/react-query-persist-client popularity was classified as popular.
We found that @tanstack/react-query-persist-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.