Created
May 24, 2023 00:11
-
-
Save develohpanda/bf6da5a2872fe9c5caa829542417ab9e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ComponentType, FC, PropsWithChildren } from 'react'; | |
const Starter: FC<PropsWithChildren> = ({ children }) => <>{children}</>; | |
export const withWrappers = (...params: ComponentType<PropsWithChildren>[]) => | |
params.reduce((Previous, Current) => { | |
const Wrapped: FC<PropsWithChildren> = ({ children }) => ( | |
<Previous> | |
<Current>{children}</Current> | |
</Previous> | |
); | |
return Wrapped; | |
}, Starter); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment