StoreAfterCreateHandler
See source codeHandler function called after a record has been successfully created in the store. Use this for side effects that should happen after record creation, such as updating related records or triggering notifications.
type StoreAfterCreateHandler<R extends UnknownRecord> = (
record: R,
source: 'remote' | 'user'
) => void
Example
const handler: StoreAfterCreateHandler<BookRecord> = (book, source) => {
if (source === 'user') {
console.log(`New book added: ${book.title}`)
updateAuthorBookCount(book.authorId)
}
}
Parameters
Name | Description |
---|---|
| The record that was created |
| Whether the change originated from 'user' interaction or 'remote' synchronization |
Prev
StoreAfterChangeHandlerNext
StoreAfterDeleteHandler