除非目录存在,否则我就不需要所有复印件。
const GeneralInfoForm = ({ currentStep, setCurrentStep }: GeneralInfoFormValues) => {
const user = getCurrentUser();
const dispatch= useAppDispatch()
// Mutation hook for adding catalogue info
const [addCatalogueInfoMutation, { isLoading }] = useAddCatalogueInfoMutation();
const CatalogueIdFromStore=useAppSelector((state)=>state.catalogueId.id)
const { data} = CatalogueIdFromStore && useGetCatalogueDataByIdQuery({ catalogueId:CatalogueIdFromStore,queryParams: });
console.log(data,"from general info")
但它说的是:
React Hook "useGetCatalogueDataByIdQuery" is called conditionally. React Hooks must be called in the exact same order in every component render.eslintreact-hooks/rules-of-hooks
(alias) useGetCatalogueDataByIdQuery<UseQueryStateDefaultResult<QueryDefinition<any, BaseQueryFn<FetchArgs, BaseQueryApi, DefinitionType>, "brand" | "draftsTask" | "allEmployees", any, "baseApi">>>(arg: any, options?: (UseQuerySubscriptionOptions & UseQueryStateOptions<...>) | undefined): UseQueryHookResult<...>
import useGetCatalogueDataByIdQuery
如何解决这一问题?