diff --git a/docs/basics/functional-programming-and-jotai.mdx b/docs/basics/functional-programming-and-jotai.mdx index 1078821470..f1e08485ef 100644 --- a/docs/basics/functional-programming-and-jotai.mdx +++ b/docs/basics/functional-programming-and-jotai.mdx @@ -23,12 +23,13 @@ const greetingAtom = atom((get) => { ``` Now, compare that code with `async`–`await`: + ```tsx const namePromise = Promise.resolve('Visitor') const countPromise = Promise.resolve(1) -const greetingPromise = (async function() { - const name = await namePromise; - const count = await countPromise; +const greetingPromise = (async function () { + const name = await namePromise + const count = await countPromise return (
Hello, {nameAtom}! You have visited this page {countAtom} times. diff --git a/readme.md b/readme.md index ed99691126..3c4408968b 100644 --- a/readme.md +++ b/readme.md @@ -163,7 +163,7 @@ function Controls() { ### Note about functional programming Jotai's fluid interface is no accident — atoms are monads, just like promises! -Monads are an [established](https://en.wikipedia.org/wiki/Monad_(functional_programming)) +Monads are an [established]() pattern for modular, pure, robust and understandable code which is [optimized for change](https://overreacted.io/optimized-for-change/). Read more about [Jotai and monads.](https://jotai.org/docs/basics/functional-programming-and-jotai)