0.1.3 • Published 2 years ago

next-jotai-sync-location v0.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Sync jotai atoms with Next.js router

Why?

As dai-shi mentioned, there is no easy way to keep atoms in sync with window.location or the various available routers, so i wrote a simple wrapper over atomWithStorage.

Install

yarn add next-jotai-sync-location

or

npm install next-jotai-sync-location

How to use

Method has the same signature as atomWithHash, but you can't provide a subscription callback.

import atomWithLocation from "next-jotai-sync-location"

const countAtom = atomWithLocation("count", 0)
const countAtomWithReplace = atomWithLocation("count", 0, {
  replaceState: true
})
const countAtomWithoutDelay = atomWithLocation("count", 0, { delayInit: false })
0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago