Function normalizeAttrProps

  • place top level props into the props[ATTRS] field. this is useful for HTMLElement and SVGElement component generators.

    Parameters

    Returns DefaultProps

    Example

    const normalized_props = normalizeAttrProps({
    width: 50,
    height: 30,
    [ATTRS]: {
    height: 40,
    style: "background-color: red;",
    },
    [EVENTS]: { click: () => { console.log("you suck") } }
    })
    // this will now produce: the following equivalent structure:
    normalized_props === {
    [ATTRS]: {
    width: 50,
    height: 40, // notice that the thing in `[ATTRS]` has a higher precedence.
    style: "background-color: red;",
    },
    [EVENTS]: { click: () => { console.log("you suck") } }
    }

Generated using TypeDoc