Forest.js Core Documentation - v1.2.3
    Preparing search index...

    Function addChild

    • addChild

      Type Parameters

      • E extends HTMLElement

        Element type

      • R extends Child | Promise<Child> | Promise<{ default: Child }>

        Child content to add (can be promise or dynamic import)

      • S extends StoreMap<any> = StoreMap<any>

        StoreMap type when used reactively

      Parameters

      • ...args: UtilityProps<R, S>

        Child content or store and mapper function

      Returns (el: E) => E

      Utility function for adding children

      Utility for adding children to an element

      addChild("Hello")(MyElement);
      // if you want to add head in your app, you can do this:
      addChild([...someHead's children])(tree("head"));