SolidJSS
SolidJSβ€’3y agoβ€’
37 replies
Zanoryt

How can I access a store from the parent context from inside of a nested context?

I am trying to access the WebsocketContext from inside of the DataStreamContext, in order to send out a websocket message when a DataStreamContext function is called. I can't seem to figure out the right way to do this.

Provider structure:
    <Html lang="en">
      <Head>
        <Title>Airframes</Title>
        <Meta charset="utf-8" />
        <Meta name="viewport" content="width=device-width, initial-scale=1" />
      </Head>
      <Body>
        <Suspense>
          <ErrorBoundary>
            <WebsocketProvider>
              <DataStreamProvider>
                <Routes>
                  <FileRoutes />
                </Routes>
              </DataStreamProvider>
            </WebsocketProvider>
          </ErrorBoundary>
        </Suspense>
        <Scripts />
      </Body>
    </Html>
Was this page helpful?