
Company News
Socket Joins the OpenJS Foundation
Socket is proud to join the OpenJS Foundation as a Silver Member, deepening our commitment to the long-term health and security of the JavaScript ecosystem.
@rest-hooks/experimental
Advanced tools
Field application of designs help smooth edges of a theoretical design. New designs can be iterated on here, breaking freely without worry of legacy support plans.
const controller = useController();
return (
<form onSubmit={() => controller.fetch(User.create(), userPayload)}>
<button onClick={() => controller.fetch(User.list())}>Refresh list</button>
<button onClick={() => controller.invalidate(User.list())}>Suspend list</button>
</form>
);
const createUser = new Endpoint(postToUserFunction, {
schema: User,
update: (newUserId: string) => ({
[userList.key({})]: (users = []) => [newUserId, ...users],
}),
});
const createUser = new Endpoint(postToUserFunction, {
schema: User,
update: (newUserId: string, newUser: User) => {
const updates = {
[userList.key()]: (users = []) => [newUserId, ...users],
[userList.key({ sortBy: 'createdAt' })]: (users = [], { sortBy }) => {
const ret = [newUserId, ...users];
ret.sortBy(sortBy);
return ret;
},
];
if (newUser.isAdmin) {
updates[userList.key({ admin: true })] = (users = []) => [newUserId, ...users];
}
return updates;
},
});
Addition of paginated().
class NewsResource extends Resource {
static listPage<T extends typeof NewsResource>(this: T) {
return this.list().paginated(({ cursor, ...rest }) => [rest]);
}
}
import { useSuspense, useController } from '@rest-hooks/react';
import NewsResource from 'resources/NewsResource';
function NewsList() {
const { results, cursor } = useSuspense(NewsResource.list(), {});
const curRef = useRef(cursor);
curRef.current = cursor;
const controller = useController();
const getNextPage = useCallback(
() => controller.fetch(NewsResource.listPage(), { cursor: curRef.current }),
[]
);
return (
<Pagination onPaginate={getNextPage} nextCursor={cursor}>
<NewsList data={results} />
</Pagination>
);
}
FAQs
Experimental extensions for Rest Hooks
We found that @rest-hooks/experimental demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.

Company News
Socket is proud to join the OpenJS Foundation as a Silver Member, deepening our commitment to the long-term health and security of the JavaScript ecosystem.

Security News
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.

Security News
A compromised npm publish token was used to push a malicious postinstall script in cline@2.3.0, affecting the popular AI coding agent CLI with 90k weekly downloads.