LocalMutationAction

LocalMutationAction is a type which defines the structure of local mutation actions. You can use it if you use Typescript, for example:

import { LocalMutationAction } from '@redux-requests/core';
function updateBookName(id: string, newName: string): LocalMutationAction {
return {
type: 'UPDATE_BOOK_NAME',
meta: {
mutations: {
FETCH_BOOK: {
updateData: data =>
data && data.id === id ? { ...data, name: newName } : data,
local: true,
},
},
},
};
}

...or if fetchBook is normalized, you could just:

import { LocalMutationAction } from '@redux-requests/core';
function updateBookName(id: string, newName: string): LocalMutationAction {
return {
type: 'UPDATE_BOOK_NAME',
meta: {
localData: { id, name: newName },
},
};
}
Last updated on by Konrad