Skip to content

Instantly share code, notes, and snippets.

@yaralahruthik
Created December 7, 2021 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yaralahruthik/1a60152e0b13e9d69bbf9c19afa78651 to your computer and use it in GitHub Desktop.
Save yaralahruthik/1a60152e0b13e9d69bbf9c19afa78651 to your computer and use it in GitHub Desktop.
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react';
export const todoApi = createApi({
reducerPath: 'todoApi',
baseQuery: fetchBaseQuery({
baseUrl: 'https://jsonplaceholder.typicode.com/',
}),
endpoints: (builder) => ({
getTodos: builder.query({
query: () => 'todos',
}),
}),
});
export const { useGetTodosQuery } = todoApi;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment