Function withHocs

  • Apply multiple hocs

    Type Parameters

    • const Hocs extends readonly WithHocsArg[]

    Parameters

    Returns Hoc<WithHocsFlat<[...Hocs]>>

    Example

    const NewComponent = withHocs([withWrapper(A), withWrapper(B)])(MyComponent)
    <A>
    <B>
    <NewComponent ... />
    </B>
    </A>

    Example

    const MyComponent = (() => {
    function MyComponent(props: { ... }) {
    return <OtherComponents />;
    }
    return withHocs([ ... ])(MyComponent);
    })();

    Example

    import { withHoc1, withHoc1 } from 'my-hocs'
    // `withHoc1_2` can be used somewhere else
    export const withHoc1_2 = withHocs([withHoc1, withHoc2])

Generated using TypeDoc