Skip to content

Commit

Permalink
English updates. (#2614)
Browse files Browse the repository at this point in the history
* Update family.mdx

English improvements for clarity.

* Update concepts.mdx

Typos and derivated to derived.

reference: https://word.tips/spelling/derived-vs-derivated/
  • Loading branch information
ideabrian authored Jun 18, 2024
1 parent 26b99a4 commit 7613f8a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions docs/basics/concepts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ The React world is very much like our world, it's a big set of small entities, w
Now, the Jotai world also has its small entities, atoms, and they also have their state. Composing atoms will create your app state!

Jotai considers anything to be an atom, so you may say: `Huh, I need objects and arrays, filter them and then sort them out`.
And here's the beauty of it, Jotai gracefully lets you create dumb atoms derivated from even more dumb atoms.
And here's the beauty of it, Jotai gracefully lets you create dumb atoms derived from even more dumb atoms.

If, for example, I have a page with 2 tabs: online friends and offline friends.
I will have 2 atoms simply derivating from a common, dumber source.
I will have 2 atoms simply derived from a common, dumber source.

```js
const dumbAtom = atom([{ name: 'Friend 1', online: false }])
Expand All @@ -27,4 +27,4 @@ const offlineAtom = atom((get) => get(dumbAtom).filter((item) => !item.online))

And you could keep going on complexity forever.

Another incredible feature of Jotai is the built-in ability to suspend when using asynchronous atoms. This is a relatively new features that yet needs to get experimented more, but definitely the future of how we build React apps. [Check out the docs](https://react.dev/blog/2022/03/29/react-v18#new-suspense-features) for more info.
Another incredible feature of Jotai is the built-in ability to suspend when using asynchronous atoms. This is a relatively new feature that needs more experimentation, but is definitely the future of how we will build React apps. [Check out the docs](https://react.dev/blog/2022/03/29/react-v18#new-suspense-features) for more info.
8 changes: 4 additions & 4 deletions docs/utilities/family.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ atomFamily(initializeAtom, areEqual): (param) => Atom
```

This will create a function that takes `param` and returns an atom.
If it's already created, it will return it from the cache.
`initializeAtom` is function that can return any kind of atom (`atom()`, `atomWithDefault()`, ...).
Note that `areEqual` is optional, which tell
If the atom has already been created, it will be returned from the cache.
`initializeAtom` is a function that can return any kind of atom (`atom()`, `atomWithDefault()`, ...).
Note that the `areEqual` argument is optional and compares
if two params are equal (defaults to `Object.is`).

To reproduce the similar behavior to [Recoil's atomFamily/selectorFamily](https://recoiljs.org/docs/api-reference/utils/atomFamily),
To reproduce behavior similar to [Recoil's atomFamily/selectorFamily](https://recoiljs.org/docs/api-reference/utils/atomFamily),
specify a deepEqual function to `areEqual`. For example:

```js
Expand Down

0 comments on commit 7613f8a

Please sign in to comment.