You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`@libre/atom` provides a data type called `Atom`s and a few functions for working with `Atom`s. It is heavily inspired by `atom`s in Clojure(Script). While the full power of Clojure `atom`s cannot be experienced in JavaScript's single-threaded runtime, `Atom`s do still offer similar benefits due to the highly asynchronous and event-driven nature of JavaScript.
32
+
`@steem-monsters/atom` provides a data type called `Atom`s and a few functions for working with `Atom`s. It is heavily inspired by `atom`s in Clojure(Script). While the full power of Clojure `atom`s cannot be experienced in JavaScript's single-threaded runtime, `Atom`s do still offer similar benefits due to the highly asynchronous and event-driven nature of JavaScript.
33
33
34
34
Atoms provide a predictable way to manage state shared by multiple components of a
35
35
program as that state changes over time. They are particularly useful in the functional and reactive programming paradigms, where most components of a program are pure functions operating on immutable data. `Atoms` provide a controlled mechanism for mutability that lets multiple components access and update the same value without risking mutating another component's reference to it in the middle of some process or asynchronous operation.
36
36
37
37
### Put your state in an `Atom`:
38
38
39
39
```ts
40
-
import { Atom } from"@libre/atom";
40
+
import { Atom } from"@steem-monsters/atom";
41
41
42
42
const appState =Atom.of({
43
43
color: "blue",
@@ -50,7 +50,7 @@ const appState = Atom.of({
50
50
You can't inspect `Atom` state directly, you have to `deref`erence it, like this:
51
51
52
52
```js
53
-
import { deref } from"@libre/atom";
53
+
import { deref } from"@steem-monsters/atom";
54
54
55
55
const { color } =deref(appState);
56
56
```
@@ -74,7 +74,7 @@ function swap<S>(
74
74
To illustrate, here is how we might update `appState`'s color:
0 commit comments