useMutationKey<R> function

MutationKey<R> useMutationKey<R>({
  1. String? of,
  2. MutationKey<R>? key,
})

Implementation

MutationKey<R> useMutationKey<R>({String? of, MutationKey<R>? key}) {
  return useMemoized(() {
    if (of != null && key != null) {
      throw const MutationException("of and key 같이 쓸수 없음.");
    }
    if (of == null) {
      return key ?? MutationKey<R>();
    }
    return MutationKey.of<R>(of);
  }, [of, key]);
}