
Security News
Deno 2.4 Brings Back deno bundle, Improves Dependency Management and Observability
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
resource-toolkit
Advanced tools
Async and RESTful resource management tool.
Often we consume RESTful APIs, like for a CRUD, using reactive UIs (with React or not). And there are a few state scenarios always present and our UI demands some questions to be answered:
filter
when you remove elements for your data?map
for editing?While this is not a UI lib, it's a state helper to automate all of these state changes above. It's type safed, has high test coverage (written with TDD). Your code commits using this for repetitive CRUDs will be short, readable, safer by pure automation. You'll be free to focus on crafting other complex designed behaviours.
This lib is a composition mostly pure functions (based on Reducer pattern), so It's also supposed to be easily integrated on any state manager you're using, like Redux, MobX or just raw React Hooks (or even class-based life cycle methods).
npm install --save resource-toolkit
You may already see a running To Do List application here, crafted for didactic reasons with a friend: https://github.com/Mazuh/octo-todo (warning: it is currently using an old version unstable version)
Here are a few dumb examples in React.
import React from "react";
import { makeReducerAssets } from 'resource-toolkit';
const usersResource = makeReducerAssets({
name: 'user',
idKey: 'userId',
gateway: {
fetchMany: async (ids = null, ...args) => {
return [
{ userId: 42, name: 'Marcell' },
{ userId: 11, name: 'David' },
{ userId: 22, name: 'Rodrigo' },
];
},
},
});
export default function App() {
const [users, dispatch] = React.useReducer(usersResource.reducer, usersResource.initialState);
React.useEffect(() => {
usersResource.actions.readAll()(dispatch);
}, [dispatch]);
if (users.isLoading) {
return <p>Doing something...</p>;
}
if (users.items.length === 0) {
return <p>No users found.</p>;
}
return (
<div>
<ul>
{users.items.map(user => (
<li key={user.userId}>{user.name}</li>
))}
</ul>
</div>
);
}
Check it out on CodeSandbox: https://codesandbox.io/s/resource-toolkit-usage-7h9td?fontsize=14&hidenavigation=1&theme=dark
Feel free to fork it and test the features by yourself.
Please consult CONTIRBUTING for guidelines on contributing to this project.
FAQs
Async and RESTful resource management tool.
The npm package resource-toolkit receives a total of 95 weekly downloads. As such, resource-toolkit popularity was classified as not popular.
We found that resource-toolkit demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.