I want to use mutation result as props like following code:
function Foo() {
const [updateEmail, result] = useUpdateEmailMutation()
return (
<>
<Bar result={result} />
<Baz result={result} />
</>
I wonder I can give some specific types to result props of Bar other than any type.
interface IProps {
result: any <- here
}
const Foo: React.FC<IProps> = ({result}) => {
...
}
You would type the according endpoint definition
const api = createApi({
baseQuery: fetchBaseQuery({ baseUrl: '/' }),
endpoints: (build) => ({
updateEmail: build.mutation<ResultType, QueryArg>({
query: (arg) => { /*...*/ },
}),
}),
})