Contentful Personalization & Analytics
    Preparing search index...
    • Create an effect to run arbitrary code in response to signal changes.

      An effect tracks which signals are accessed within the given callback function fn, and re-runs the callback when those signals change.

      The callback may return a cleanup function. The cleanup function gets run once, either when the callback is next called or when the effect gets disposed, whichever happens first.

      Parameters

      • fn: EffectFn

        The effect callback.

      • Optionaloptions: EffectOptions

      Returns () => void

      A function for disposing the effect.