You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Context primitive adds functionality to easily create context providers through createContextProvider. Given the example code on the website, ...
const[CounterProvider,useCounter]=createContextProvider((props: {initial: number})=>{const[count,setCount]=createSignal(props.initial);constincrement=()=>setCount(count()+1);return{ count, increment };});// Provide the context<CounterProviderinitial={1}><App/></CounterProvider>;
... the following code does not work when paired with the MultiProvider as it only accepts a single argument value:
<MultiProvidervalues={[[CounterProvider,{initial: 1}]// not working, as this is passed to the single `value` field.]}><App/></MultiProvider>;
Suggest A Solution
It would be nice if the individual contexts of MultiProvider accepted the same props as returned from createContextProvider so they seamlessly work together. A workaround would be to wrap the context props with { value: ContextProps }, but this destroys usability and requires refactoring the entire codebase
The text was updated successfully, but these errors were encountered:
Describe The Problem To Be Solved
The
Context
primitive adds functionality to easily create context providers throughcreateContextProvider
. Given the example code on the website, ...... the following code does not work when paired with the
MultiProvider
as it only accepts a single argumentvalue
:Suggest A Solution
It would be nice if the individual contexts of
MultiProvider
accepted the same props as returned fromcreateContextProvider
so they seamlessly work together. A workaround would be to wrap the context props with{ value: ContextProps }
, but this destroys usability and requires refactoring the entire codebaseThe text was updated successfully, but these errors were encountered: