![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
rest-api-kit
Advanced tools
Welcome to rest-api-kit
– your go-to solution for gaining precise control over caching in API requests within your React and React Native applications. Tired of feeling restricted by caching mechanisms that lack flexibility and clarity? Look no further. With rest-api-kit
, developers like you can finally take charge of caching with ease. Say goodbye to complex configurations and unreliable results. Our package empowers you to determine exactly when cache entries are created, updated, or deleted, based on parameters you define. Whether you're building a web application with React or a mobile app with React Native, rest-api-kit
simplifies caching implementation without compromising on effectiveness. Take control of your cache today with rest-api-kit
rest-api-kit is available for use as a package on npm:
npm i rest-api-kit
or yarn:
yarn add rest-api-kit
Rest API kit comes with a base and hooks. The hooks are created from endpoint objects that are injected with the createEndpoints method as you'll see in the usage section of this documentation.
Import the createRestBase
from rest-api-kit
like so:
import { createRestBase } from "rest-api-kit";
assign it to a variable like so:
const api = createRestBase({ baseUrl: "https://jsonplaceholder.typicode.com" });
Create the endpoints at the base of your index file or App so it gets loaded in soon as uour project starts up.
const injector = api.createEndpoints((builder) => ({
getATodo: builder({
url: "/todos/1",
params: {
preferCacheValue: false,
saveToCache: true,
successCondition: (data) => {
if (data.completed) {
return true;
}
return false;
},
transformResponse: (data) => {
// always return data;
return data;
}
}
}),
createTodo: builder({
url: "/post",
params: {
method: 'POST',
updates: ['getATodo'],
}
}),
}));
export const { useGetATodo, useCreateTodo, useDeleteTodo } = injector;
In the components that you need it in, you can use it like so:
const [getATodo, { data }] = useGetATodo();
const [deleteATodo, state] = useDeleteTodo();
console.log(state, "<= state");
useEffect(() => {
getATodo();
}, [])
const deleteTodo = () => {
deleteATodo({
id: todoId
})
}
FAQs
A package to manage your rest api calls, cache mutations and all
The npm package rest-api-kit receives a total of 30 weekly downloads. As such, rest-api-kit popularity was classified as not popular.
We found that rest-api-kit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.