Function withPick

  • Pick, which is actually ignore other props

    Type Parameters

    • PickNames extends string

    Parameters

    Returns Hoc<[WithPickFn<PickNames>]>

    See

    withOmit

    Example

    const user = {
    username: "Some username",
    password: "s0m3 p4ssw0rd",
    vitalSecretInfo: "..."
    };
    function RevealInfo(
    { username, password, vitalSecretInfo }:
    { username: string; password?: string; vitalSecretInfo: string }
    ) {
    ...
    }
    const SafeRevealInfo = withPick(["username"])(RevealInfo);
    <SafeRevealInfo {...user} />
    // is equivalent to
    <RevealInfo username={user.username} /> // password and vitalSecretInfo is not included

Generated using TypeDoc