Skip to content

Instantly share code, notes, and snippets.

View ksimons's full-sized avatar

Kevin Simons ksimons

View GitHub Profile
@ksimons
ksimons / recoil-transactions.tsx
Created October 12, 2022 12:11
Using Recoil.js transactions
interface BulkItemCreator {
create(items: Array<{ id: string; name: string }>): void;
}
export function useBulkCreateExample() {
return useRecoilCallback(
({ transact_UNSTABLE }) =>
(callback: (creator: BulkItemCreator) => void) => {
transact_UNSTABLE(({ set, get }) => {
callback({