Skip to content

Commit

Permalink
fix(docs/optics): fix typo. (pmndrs#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
merisbahti authored Nov 26, 2020
1 parent 4141d69 commit 850566a
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions docs/optics.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,12 @@ To see more advanced optics, please see the example at: https://github.com/akher

```js
import { atom } from 'jotai'
import { useFocus } from 'jotai/optics'
import { focusAtom } from 'jotai/optics'

const objectAtom = atom({a: 5, b: 10})
const aAtom = focusAtom(objectAtom, optic => optic.prop('a'))
const bAtom = focusAtom(objectAtom, optic => optic.prop('b'))

const Counter = () => {
const [count] = useAtom(countAtom)
return <div>count: {count}</div>
}

const Controls = () => {
const [a, setA] = useAtom(aAtom)
const [b, setB] = useAtom(aAtom)
Expand Down

0 comments on commit 850566a

Please sign in to comment.