Skip to content

Instantly share code, notes, and snippets.

@jasonleehodges
Last active December 11, 2021 19:34
Show Gist options
  • Save jasonleehodges/c7377501a643aff7e650e109021408c2 to your computer and use it in GitHub Desktop.
Save jasonleehodges/c7377501a643aff7e650e109021408c2 to your computer and use it in GitHub Desktop.
Counter Selector File
export const selectCount = (state: RootState) => state.counter.value;
export const selectCountFormatted =
(formatter: "$" | "%") => (state: RootState) =>
`${formatter === "$" ? "$" : ""}${selectCount(state)}${
formatter === "%" ? "%" : ""
}`;
export const selectCountAndStatus = (state: RootState) =>
`The current count is ${selectCount(state)} and the status is ${
state.counter.status
}`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment