From cce115f13c7c315a2e1d3e7f5a59ee0be4e1ab28 Mon Sep 17 00:00:00 2001 From: Yair Even Or Date: Sun, 10 Nov 2024 12:32:45 +0100 Subject: [PATCH] Updated `location.mdx` regarding `atomWithLocation` instances (#2805) * Update location.mdx Added an important warning note against instantiating `atomWithLocation` more than once in an app * ran `prettier` npm script and added 2 `code` annotations for the new paragraph --- docs/extensions/location.mdx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/extensions/location.mdx b/docs/extensions/location.mdx index d35ba767f3..62af53a381 100644 --- a/docs/extensions/location.mdx +++ b/docs/extensions/location.mdx @@ -23,6 +23,9 @@ atomWithLocation(options): PrimitiveAtom `atomWithLocation` creates a new atom that links to `window.location`. +Typically, you should only instantiate `atomWithLocation` once per application. This is because changes made to one instance might not be reflected in others. +As this atom is designed to synchronize with the `window.location` object, using multiple instances can lead to unpredictable behavior. + ### Parameters **options** (optional): an object of options to customize the behavior of the atom