Function withSpread

  • Experimental

    Start receiving an object and spread all properties to Component

    It uses the same mechanism as withDefaults but it could also have the same mechanism as withOverrides

    Type Parameters

    • PropName extends string

    • Names extends string

    Parameters

    Returns Hoc<[WithSpreadFn<PropName, Names>]>

    Example

    function Profile({ name, age, city }: {...}) {
    ...
    }
    const NewProfile = withSpread<"profile", "name" | "age" | "city">("profile")(Profile)
    <NewProfile profile={{ name: "Some Name", age: 20, city: "Some City" }} />
    // is equivalent to
    <Profile name="Some Name" age={20} city="Some City" />

Generated using TypeDoc