Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

use `MultiProvider` with arbitrary props and not only `value: T`

Offen
#755 1 Kommentar 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
48/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Ruhig
Tech-Stack
typescript
Bereich
frontend

Rechercherichtung

Beginne damit, die Einstiegspunkte MultiProvider und createContextProvider sowie deren TypeScript-Prop-Definitionen zu lesen. Prüfe, wie MultiProvider den aktuellen Wert jedes Contexts weitergibt, und verifiziere anschließend, dass mit beliebigen Props wie { initial: 1 } erstellte Contexts übergeben werden können, ohne sie in { value: ... } zu verpacken.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

enhancement help wanted
Describe The Problem To Be Solved

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);
  const increment = () => setCount(count() + 1);
  return { count, increment };
});

// Provide the context
<CounterProvider initial={1}>
  <App />
</CounterProvider>;

... the following code does not work when paired with the MultiProvider as it only accepts a single argument value:

<MultiProvider
  values={[
    [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

Vorherrschende Sprache
TypeScript
Sterne
1.6k
Forks
162
Ø Merge
1 Std. 20 Min.
Gemergte PRs (30 T.)
7

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus solidjs-community/solid-primitives

Alle Issues in solidjs-community/solid-primitives

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.