Created
November 13, 2021 04:49
-
-
Save techomoro/713939310cd1b9c924be1c4602704dba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { selector } from "recoil"; | |
import { nameState } from "../atoms/name"; | |
export const lengthState = selector({ | |
key: "lengthState", // unique ID (with respect to other atoms/selectors) | |
get: ({ get }) => { | |
const name = get(nameState); | |
const lengthOfName = name.length; | |
return lengthOfName; | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment