All Projects → sergiodxa → swr-mutate-many

sergiodxa / swr-mutate-many

Licence: MIT license
Little function to call mutate against multiple cached keys of SWR

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to swr-mutate-many

graphql-codegen-plugin-typescript-swr
A GraphQL code generator plug-in that automatically generates utility functions for SWR.
Stars: ✭ 88 (+238.46%)
Mutual labels:  swr
mongood
A MongoDB GUI with Fluent Design
Stars: ✭ 674 (+2492.31%)
Mutual labels:  swr
react-apollo-mutation-state
A React HOC wrapper for Apollo GraphQL mutation, provides loading and error in props
Stars: ✭ 16 (-38.46%)
Mutual labels:  mutate
Swr
React Hooks for data fetching
Stars: ✭ 20,348 (+78161.54%)
Mutual labels:  swr
expansion-pack
🔋 Useful stack expansion for ts-nextjs-tailwind-starter
Stars: ✭ 16 (-38.46%)
Mutual labels:  swr
swr-examples
SWR is a React Hook library for remote data fetching. Here are some simple examples.
Stars: ✭ 14 (-46.15%)
Mutual labels:  swr
use-mutation
🧬 Run side-effects safely in React
Stars: ✭ 81 (+211.54%)
Mutual labels:  swr
static-template-nextjs
A Next.js based template of a blog built using the Collected Notes API
Stars: ✭ 19 (-26.92%)
Mutual labels:  swr
netease-music-app
网易云音乐移动端【React/Next/Vue】【Ant Design/Material UI】
Stars: ✭ 95 (+265.38%)
Mutual labels:  swr
swr-devtools
Devtools for SWR
Stars: ✭ 17 (-34.62%)
Mutual labels:  swr
pub-apis
Find public APIs, powered by api(dot)publicapis(dot)org
Stars: ✭ 24 (-7.69%)
Mutual labels:  swr
benjamincarlson.io
My personal website built with Next.js, Chakra UI, Firebase, and next-mdx-remeote.
Stars: ✭ 102 (+292.31%)
Mutual labels:  swr
webev-front
Webev is OSS of bookmark manager that improves the organization of information.
Stars: ✭ 27 (+3.85%)
Mutual labels:  swr
swr-graphql
A sample Next.js app using Zeit's SWR React Hooks to make GraphQL Queries/Mutations/Subscriptions
Stars: ✭ 117 (+350%)
Mutual labels:  swr
swr-devtools
A DevTool for SWR
Stars: ✭ 45 (+73.08%)
Mutual labels:  swr
example-next-isr-with-swr
Lightning fast static pages with ISR, instantly updated with SWR ⚡️
Stars: ✭ 48 (+84.62%)
Mutual labels:  swr
booktez-client
📚진짜 독서가들의 독서법 - 북스테어즈 (React)
Stars: ✭ 53 (+103.85%)
Mutual labels:  swr

SWR Mutate Many

CI Publish Maintainability Test Coverage

Little function to call mutate against multiple cached keys of SWR.

Usage

Install it

$ yarn add swr swr-mutate-many

Import it and use it

import { mutateMany } from 'swr-mutate-many';

mutateMany('key-*', 'New Value', false);

Now mutateMany will change the value of any key matching the glob key-* (any starting with key-) to have the value "New Value" and it won't trigger a revalidation.

API

mutateMany follow a similar API as SWR mutate.

  1. The key to mutate, in our case it could be:
  • A string supporting globs to match the key, useful for simple logic
  • A function which will receive the key and should return true/false if it matches, useful for complex logic
  1. The new value to use, a promise whose resolved value will be used or a function receiving the current value
  2. If the keys should be revalidated, in our case it could be:
  • A boolean, as in mutate, useful if you want all to revalidate or not
  • A function, which will receive the key and return a boolean, useful for complext logic
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].