Skip to content

Ability to pass callback function during store creation for store initialisation and updates #186

@KennyYe

Description

@KennyYe

We would like the ability to pass in certain callback functions when stores are created that would track:

  1. Store initialisation
  2. Store changes
const onStoreInit = (storeInstance) => {
    // do something when store initialises
};

const onStoreUpdate = (storeInstance, actionDispatched) => {
    // do something when store updates
};

export const store = createStore({
    ...
    name: 'my-store',
    onStoreInit,
    onStoreUpdate,
});

This would allow us to implement custom logic into our stores changing without having to mount many useEffects to track and respond to these changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions