{"_id":"@1771technologies/atom","_rev":"3-3ee1217480e6fd90f5c1653c3037bc33","name":"@1771technologies/atom","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@1771technologies/atom","version":"1.0.0","keywords":["react","state","manager","management","recoil","store"],"author":{"name":"Daishi Kato"},"license":"MIT","_id":"@1771technologies/atom@1.0.0","maintainers":[{"name":"lee1771","email":"leebeydoun@1771technologies.com"},{"name":"admin1771","email":"admin@1771technologies.com"}],"contributors":[],"homepage":"https://github.com/pmndrs/jotai","bugs":{"url":"https://github.com/pmndrs/jotai/issues"},"dist":{"shasum":"7f287a7d46f34a38cfe7a01575f1c76543483748","tarball":"https://registry.npmjs.org/@1771technologies/atom/-/atom-1.0.0.tgz","fileCount":214,"integrity":"sha512-KzvbFsxqwqVe25bLJd4dx/4zaXxnuRYGXKlzmgj+KLvCYuwoKh9aI+GoS4mrsCS3W8M4faN+WSfB52JZNWnDSg==","signatures":[{"sig":"MEYCIQDrM2kZAf6Xuu5yneXtyjaRBtXZDNe3GNrjS5Wh6utW7AIhAI1Pvh/g/UVaUfKjUbSuR+qSMrjDu2C58U9dRF+nW8i5","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":499743},"main":"./index.js","type":"commonjs","_from":"file:1771technologies-atom-1.0.0.tgz","types":"./index.d.ts","engines":{"node":">=12.20.0"},"exports":{".":{"import":{"types":"./esm/index.d.mts","default":"./esm/index.mjs"},"default":{"types":"./index.d.ts","default":"./index.js"},"react-native":{"types":"./index.d.ts","default":"./index.js"}},"./*":{"import":{"types":"./esm/*.d.mts","default":"./esm/*.mjs"},"default":{"types":"./*.d.ts","default":"./*.js"},"react-native":{"types":"./*.d.ts","default":"./*.js"}},"./package.json":"./package.json"},"private":false,"_npmUser":{"name":"admin1771","email":"admin@1771technologies.com"},"_resolved":"/private/var/folders/zw/htw2k_w50jx01ykx8cwf8wch0000gn/T/85239b84b5ebd76992535d67b845db5d/1771technologies-atom-1.0.0.tgz","_integrity":"sha512-KzvbFsxqwqVe25bLJd4dx/4zaXxnuRYGXKlzmgj+KLvCYuwoKh9aI+GoS4mrsCS3W8M4faN+WSfB52JZNWnDSg==","repository":{"url":"git+https://github.com/pmndrs/jotai.git","type":"git"},"_npmVersion":"10.9.2","description":"A Jotai fork managed by 1771 Technologies","directories":{},"sideEffects":false,"_nodeVersion":"23.11.0","publishConfig":{"access":"public"},"typesVersions":{"*":{"*":["ts_version_3.8_and_above_is_required.d.ts"],"esm/*":["ts_version_3.8_and_above_is_required.d.ts"]},">=3.8":{"*":["ts3.8/*"],"esm/*":["ts3.8/*"]},">=4.8":{"*":["*"],"esm/*":["esm/*"]}},"_hasShrinkwrap":false,"peerDependencies":{"react":">=17.0.0","@types/react":">=17.0.0"},"peerDependenciesMeta":{"react":{"optional":true},"@types/react":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/atom_1.0.0_1747951065309_0.2347787039967255","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@1771technologies/atom","version":"1.0.1","keywords":["react","state","manager","management","recoil","store"],"author":{"name":"Daishi Kato"},"license":"MIT","_id":"@1771technologies/atom@1.0.1","maintainers":[{"name":"lee1771","email":"leebeydoun@1771technologies.com"},{"name":"admin1771","email":"admin@1771technologies.com"}],"contributors":[],"homepage":"https://github.com/pmndrs/jotai","bugs":{"url":"https://github.com/pmndrs/jotai/issues"},"dist":{"shasum":"5fe4d5b893b15661040e826f298fef66c01a3d7f","tarball":"https://registry.npmjs.org/@1771technologies/atom/-/atom-1.0.1.tgz","fileCount":214,"integrity":"sha512-r96vcpnowyaMzx3HQzvPWvddwwcgOkI/3177Q7WYZO4UCpT7KGujSZi6zwED0sScKQo3nLcgIVpCwqQltJcTnw==","signatures":[{"sig":"MEYCIQDiWO40HWdZ1RXF7o/ZqVlAwZr6D8Uah6Qr97i/apJ17QIhAIGuu/y0/CRr+lZgtfA16U0U8fyDEQ2TVRf3NkjtzLI6","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":503271},"main":"./index.js","type":"commonjs","_from":"file:1771technologies-atom-1.0.1.tgz","types":"./index.d.ts","engines":{"node":">=12.20.0"},"exports":{".":{"import":{"types":"./esm/index.d.mts","default":"./esm/index.mjs"},"default":{"types":"./index.d.ts","default":"./index.js"},"react-native":{"types":"./index.d.ts","default":"./index.js"}},"./*":{"import":{"types":"./esm/*.d.mts","default":"./esm/*.mjs"},"default":{"types":"./*.d.ts","default":"./*.js"},"react-native":{"types":"./*.d.ts","default":"./*.js"}},"./package.json":"./package.json"},"private":false,"_npmUser":{"name":"admin1771","email":"admin@1771technologies.com"},"_resolved":"/private/var/folders/zw/htw2k_w50jx01ykx8cwf8wch0000gn/T/b3a425721388e8e4fadc417c3036ec20/1771technologies-atom-1.0.1.tgz","_integrity":"sha512-r96vcpnowyaMzx3HQzvPWvddwwcgOkI/3177Q7WYZO4UCpT7KGujSZi6zwED0sScKQo3nLcgIVpCwqQltJcTnw==","repository":{"url":"git+https://github.com/pmndrs/jotai.git","type":"git"},"_npmVersion":"10.9.2","description":"A Jotai fork managed by 1771 Technologies","directories":{},"sideEffects":false,"_nodeVersion":"23.11.0","publishConfig":{"access":"public"},"typesVersions":{"*":{"*":["ts_version_3.8_and_above_is_required.d.ts"],"esm/*":["ts_version_3.8_and_above_is_required.d.ts"]},">=3.8":{"*":["ts3.8/*"],"esm/*":["ts3.8/*"]},">=4.8":{"*":["*"],"esm/*":["esm/*"]}},"_hasShrinkwrap":false,"peerDependencies":{"react":">=17.0.0","@types/react":">=17.0.0"},"peerDependenciesMeta":{"react":{"optional":true},"@types/react":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/atom_1.0.1_1748072421796_0.11860333476244","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@1771technologies/atom","description":"A Jotai fork managed by 1771 Technologies","private":false,"type":"commonjs","version":"1.0.2","main":"./index.js","types":"./index.d.ts","typesVersions":{">=4.8":{"esm/*":["esm/*"],"*":["*"]},">=3.8":{"esm/*":["ts3.8/*"],"*":["ts3.8/*"]},"*":{"esm/*":["ts_version_3.8_and_above_is_required.d.ts"],"*":["ts_version_3.8_and_above_is_required.d.ts"]}},"exports":{"./package.json":"./package.json",".":{"react-native":{"types":"./index.d.ts","default":"./index.js"},"import":{"types":"./esm/index.d.mts","default":"./esm/index.mjs"},"default":{"types":"./index.d.ts","default":"./index.js"}},"./*":{"react-native":{"types":"./*.d.ts","default":"./*.js"},"import":{"types":"./esm/*.d.mts","default":"./esm/*.mjs"},"default":{"types":"./*.d.ts","default":"./*.js"}}},"sideEffects":false,"engines":{"node":">=12.20.0"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/pmndrs/jotai.git"},"keywords":["react","state","manager","management","recoil","store"],"author":{"name":"Daishi Kato"},"contributors":[],"license":"MIT","bugs":{"url":"https://github.com/pmndrs/jotai/issues"},"homepage":"https://github.com/pmndrs/jotai","peerDependencies":{"@types/react":">=17.0.0","react":">=17.0.0"},"peerDependenciesMeta":{"@types/react":{"optional":true},"react":{"optional":true}},"_id":"@1771technologies/atom@1.0.2","_integrity":"sha512-t7HoSPpp6qA8OFFvTEdKDEzHkZtzo9HzEvUlPA+/YEcbuh1kyHoQYuYDU25oZGBXREBkJgmJNe0I+PTx+tH8vg==","_resolved":"/private/var/folders/zw/htw2k_w50jx01ykx8cwf8wch0000gn/T/2b69fef0897c3e3593ee0c41ce58334e/1771technologies-atom-1.0.2.tgz","_from":"file:1771technologies-atom-1.0.2.tgz","_nodeVersion":"23.11.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-t7HoSPpp6qA8OFFvTEdKDEzHkZtzo9HzEvUlPA+/YEcbuh1kyHoQYuYDU25oZGBXREBkJgmJNe0I+PTx+tH8vg==","shasum":"b77d5a5b1014d782da44ecf59315359730d3b018","tarball":"https://registry.npmjs.org/@1771technologies/atom/-/atom-1.0.2.tgz","fileCount":214,"unpackedSize":504132,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFoYSEk5cpXyUnQaZhIXmZ/duFVcFdfjHlXak1PwG0veAiEAnwX3XmtCacHqXElkl5j+iASwrtCiB/Tpq8Eh8liLrhU="}]},"_npmUser":{"name":"lee1771","email":"leebeydoun@1771technologies.com","actor":{"name":"lee1771","email":"leebeydoun@1771technologies.com","type":"user"}},"directories":{},"maintainers":[{"name":"lee1771","email":"leebeydoun@1771technologies.com"},{"name":"admin1771","email":"admin@1771technologies.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/atom_1.0.2_1751267745725_0.7659422986729816"},"_hasShrinkwrap":false}},"time":{"created":"2025-05-22T21:57:45.196Z","modified":"2025-06-30T07:15:46.107Z","1.0.0":"2025-05-22T21:57:45.497Z","1.0.1":"2025-05-24T07:40:22.031Z","1.0.2":"2025-06-30T07:15:45.911Z"},"bugs":{"url":"https://github.com/pmndrs/jotai/issues"},"author":{"name":"Daishi Kato"},"license":"MIT","homepage":"https://github.com/pmndrs/jotai","keywords":["react","state","manager","management","recoil","store"],"repository":{"type":"git","url":"git+https://github.com/pmndrs/jotai.git"},"description":"A Jotai fork managed by 1771 Technologies","contributors":[],"maintainers":[{"name":"lee1771","email":"leebeydoun@1771technologies.com"},{"name":"admin1771","email":"admin@1771technologies.com"}],"readme":"> [!NOTE]\n>\n> This is fork of Jotai maintained by 1771 Technologies. Do not use this directly. If you are looking\n> for a state management library use Jotai directly. We use this library internally in a number of packages\n> at 1771 Technologies.\n>\n> We forked it to ensure we have full control of downstream dependencies. We verify the commits made on Jotai\n> before pulling their code into this branch.\n>\n> Support the creators of Jotai - they made a fantastic library.\n\n<br>\n\n![Jotai (light mode)](./img/jotai-header-light.png#gh-light-mode-only)\n\n\n<br>\n\nvisit [jotai.org](https://jotai.org) or `npm i jotai`\n\n[![Build Status](https://img.shields.io/github/actions/workflow/status/pmndrs/jotai/test.yml?branch=main&style=flat&colorA=000000&colorB=000000)](https://github.com/pmndrs/jotai/actions?query=workflow%3ALint)\n[![Build Size](https://img.shields.io/bundlephobia/minzip/jotai?label=bundle%20size&style=flat&colorA=000000&colorB=000000)](https://bundlephobia.com/result?p=jotai)\n[![Version](https://img.shields.io/npm/v/jotai?style=flat&colorA=000000&colorB=000000)](https://www.npmjs.com/package/jotai)\n[![Downloads](https://img.shields.io/npm/dt/jotai.svg?style=flat&colorA=000000&colorB=000000)](https://www.npmjs.com/package/jotai)\n[![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/poimandres)\n[![Open Collective](https://img.shields.io/opencollective/all/jotai?style=flat&colorA=000000&colorB=000000)](https://opencollective.com/jotai)\n\nJotai scales from a simple useState replacement to an enterprise TypeScript application.\n\n- Minimal core API (2kb)\n- Many utilities and extensions\n- No string keys (compared to Recoil)\n\nExamples: [Demo 1](https://codesandbox.io/s/jotai-demo-47wvh) |\n[Demo 2](https://codesandbox.io/s/jotai-demo-forked-x2g5d)\n\n### First, create a primitive atom\n\nAn atom represents a piece of state. All you need is to specify an initial\nvalue, which can be primitive values like strings and numbers, objects, and\narrays. You can create as many primitive atoms as you want.\n\n```jsx\nimport { atom } from 'jotai'\n\nconst countAtom = atom(0)\nconst countryAtom = atom('Japan')\nconst citiesAtom = atom(['Tokyo', 'Kyoto', 'Osaka'])\nconst mangaAtom = atom({ 'Dragon Ball': 1984, 'One Piece': 1997, Naruto: 1999 })\n```\n\n### Use the atom in your components\n\nIt can be used like `React.useState`:\n\n```jsx\nimport { useAtom } from 'jotai'\n\nfunction Counter() {\n  const [count, setCount] = useAtom(countAtom)\n  return (\n    <h1>\n      {count}\n      <button onClick={() => setCount((c) => c + 1)}>one up</button>\n      ...\n```\n\n### Create derived atoms with computed values\n\nA new read-only atom can be created from existing atoms by passing a read\nfunction as the first argument. `get` allows you to fetch the contextual value\nof any atom.\n\n```jsx\nconst doubledCountAtom = atom((get) => get(countAtom) * 2)\n\nfunction DoubleCounter() {\n  const [doubledCount] = useAtom(doubledCountAtom)\n  return <h2>{doubledCount}</h2>\n}\n```\n\n### Creating an atom from multiple atoms\n\nYou can combine multiple atoms to create a derived atom.\n\n```jsx\nconst count1 = atom(1)\nconst count2 = atom(2)\nconst count3 = atom(3)\n\nconst sum = atom((get) => get(count1) + get(count2) + get(count3))\n```\n\nOr if you like fp patterns ...\n\n```jsx\nconst atoms = [count1, count2, count3, ...otherAtoms]\nconst sum = atom((get) => atoms.map(get).reduce((acc, count) => acc + count))\n```\n\n### Derived async atoms [<img src=\"https://img.shields.io/badge/-needs_suspense-black\" alt=\"needs suspense\" />](https://react.dev/reference/react/Suspense)\n\nYou can make the read function an async function too.\n\n```jsx\nconst urlAtom = atom('https://json.host.com')\nconst fetchUrlAtom = atom(async (get) => {\n  const response = await fetch(get(urlAtom))\n  return await response.json()\n})\n\nfunction Status() {\n  // Re-renders the component after urlAtom is changed and the async function above concludes\n  const [json] = useAtom(fetchUrlAtom)\n  ...\n```\n\n### You can create a writable derived atom\n\nSpecify a write function at the second argument. `get` will return the current\nvalue of an atom. `set` will update the value of an atom.\n\n```jsx\nconst decrementCountAtom = atom(\n  (get) => get(countAtom),\n  (get, set, _arg) => set(countAtom, get(countAtom) - 1)\n)\n\nfunction Counter() {\n  const [count, decrement] = useAtom(decrementCountAtom)\n  return (\n    <h1>\n      {count}\n      <button onClick={decrement}>Decrease</button>\n      ...\n```\n\n### Write only derived atoms\n\nJust do not define a read function.\n\n```jsx\nconst multiplyCountAtom = atom(null, (get, set, by) =>\n  set(countAtom, get(countAtom) * by),\n)\n\nfunction Controls() {\n  const [, multiply] = useAtom(multiplyCountAtom)\n  return <button onClick={() => multiply(3)}>triple</button>\n}\n```\n\n### Async actions\n\nJust make the write function an async function and call `set` when you're ready.\n\n```jsx\nconst fetchCountAtom = atom(\n  (get) => get(countAtom),\n  async (_get, set, url) => {\n    const response = await fetch(url)\n    set(countAtom, (await response.json()).count)\n  }\n)\n\nfunction Controls() {\n  const [count, compute] = useAtom(fetchCountAtom)\n  return (\n    <button onClick={() => compute('http://count.host.com')}>compute</button>\n    ...\n```\n\n### Note about functional programming\n\nJotai's fluid interface is no accident — atoms are monads, just like promises!\nMonads are an [established](<https://en.wikipedia.org/wiki/Monad_(functional_programming)>)\npattern for modular, pure, robust and understandable code which is [optimized for change](https://overreacted.io/optimized-for-change/).\nRead more about [Jotai and monads.](https://jotai.org/docs/basics/functional-programming-and-jotai)\n\n## Links\n\n- [website](https://jotai.org)\n- [documentation](https://jotai.org/docs)\n- [course](https://egghead.io/courses/manage-application-state-with-jotai-atoms-2c3a29f0)\n","readmeFilename":"README.md"}