본문으로 건너뛰기

<RecoilURLSyncJSON>

A component from the Recoil Sync library to sync atoms using the syncEffect() or urlSyncEffect() atom effects with the browser URL.

This is identical to the <RecoilURLSync> component except that it provides built-in JSON encoding and does not accept serialize/deserialize options.


The JSON standard encodes JavaScript primitives and objects with the corresponding Refine checkers:

This implementation handles undefined as an empty query param or a non-existent object property.

The Date class is also supported by encoding it as an ISO string. This can be re-hydrated back to a Date object if you use the jsonDate() checker from Refine.

The Set and Map JavaScript containers are not supported with JSON. You can use Transit encoding to encode those containers and custom user classes.

Examples

See the URL Persistence Guide for examples.