Created
December 7, 2021 16:22
-
-
Save yaralahruthik/1a60152e0b13e9d69bbf9c19afa78651 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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