Documentation
API
Cleanup

Cleanup

Is a helper function to run cleanups for an effect.

Also read Cleanup guide.

cleanup()

Signature:

cleanup(store: EffectStore, fn: () => void): void

Arguments:

  • EffectStore

  • fn - a function to run before the next run or before the effect is destroyed

Example:

 
import { cleanup } from '@nalanda/core';
 
key.effect(store => {
    cleanup(store, () => {
        // run cleanup code
    })
})