Skip to content

Instantly share code, notes, and snippets.

@IhsanMujdeci
Created September 19, 2019 05:22
Show Gist options
  • Save IhsanMujdeci/9732da3c1e816742dc586a8b3ef3c14d to your computer and use it in GitHub Desktop.
Save IhsanMujdeci/9732da3c1e816742dc586a8b3ef3c14d to your computer and use it in GitHub Desktop.
User Typed Selector
import {RootType} from "../rootreducer";
import {useSelector} from "react-redux";
export function useTypedSelector<T>(
selector: (state: RootType) => T,
equalityFn?: (left: T, right: T) => boolean): T {
return useSelector<RootType, T>(selector, equalityFn);
}
@IhsanMujdeci
Copy link
Author

Your rootType location and name will differ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment