Skip to content
Discussion options

You must be logged in to vote

Hi, from the doc (https://swr.vercel.app/docs/options), SWR uses dequal (https://github.com/lukeed/dequal) as a compare function in order to trigger a rerender or not.
Seems like the following would trigger a rerender

dequal(
   [{ id: 1 }, { id: 2, nested: { foo: "bar" } }],
   [{ id: 1 }, { id: 2, nested: { foo: "rab" } }]
) 
// == false => should trigger a rerender

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@taylorhlabs
Comment options

Answer selected by taylorhlabs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants