Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Paste
P3
provider-tree.tsx
Active
Public
Actions
Authored by
themackabu
on Sun, Oct 26, 11:59 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Flag For Later
Award Token
Tags
None
Referenced Files
F2475674: provider-tree.tsx
Sun, Oct 26, 11:59 PM
2025-10-26 23:59:49 (UTC-7)
Subscribers
None
type
ComposedProvider
=
Component
<
Children
>
;
type
FlexibleProvider
=
Component
<
NonNullableChildren
>
|
Component
<
Children
>
;
type
ProviderConfig
=
|
[
FlexibleProvider
]
|
[
FlexibleProviderWithProps
<
Record
<
string
,
unknown
>>
,
Record
<
string
,
unknown
>
];
type
FlexibleProviderWithProps
<
TProps
extends
Record
<
string
,
unknown
>>
=
|
Component
<
NonNullableChildren
&
TProps
>
|
Component
<
Children
<
TProps
>>
;
export
function
buildProvidersTree
<
TProviders
extends
ReadonlyArray
<
ProviderConfig
>>
(
providers
:
TProviders
,
)
:
ComposedProvider
{
return
providers
.
reduce
<
ComposedProvider
>
(
(
AccumulatedProviders
,
providerConfig
)
=>
{
const
[
Provider
,
props
=
{}]
=
providerConfig
;
return
({
children
})
=>
(
<
AccumulatedProviders
>
<
Provider
{...
props
}
>
{
children
}
<
/Provider>
<
/AccumulatedProviders>
);
},
({
children
})
=>
children
,
);
}
Event Timeline
themackabu
created this paste.
Sun, Oct 26, 11:59 PM
2025-10-26 23:59:49 (UTC-7)
themackabu
created this object with visibility "Public (No Login Required)".
themackabu
created this object with edit policy "
themackabu (theMackabu)
".
themackabu
updated the paste's language from
autodetect
to
js
.
Mon, Oct 27, 12:02 AM
2025-10-27 00:02:08 (UTC-7)
Log In to Comment