Skip to content

Instantly share code, notes, and snippets.

@techomoro
Created November 13, 2021 04:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save techomoro/713939310cd1b9c924be1c4602704dba to your computer and use it in GitHub Desktop.
Save techomoro/713939310cd1b9c924be1c4602704dba to your computer and use it in GitHub Desktop.
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