Skip to content

Commit

Permalink
Updated location.mdx regarding atomWithLocation instances (#2805)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
yairEO authored Nov 10, 2024
1 parent 7bf3765 commit cce115f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/extensions/location.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cce115f

Please sign in to comment.