Evan Burbidge
Dec 14, 2022

--

const providers = [{Component: XyZ, props: {a: 'b'}}]

export const combineComponents = (...components) =>

components.reduce(

(AccumulatedComponents, { CurrentComponent, props = {} }) => ({

children,

}) => (

<AccumulatedComponents>

<CurrentComponent {...props}>{children}</CurrentComponent>

</AccumulatedComponents>

),

({ children }) => <>{children}</>

);

--

--

Evan Burbidge
Evan Burbidge

Written by Evan Burbidge

Javascript developer specialising in React, Vue and NodeJS. I like SQL and NoSql depends on the context really!

No responses yet