title: Solid.js: How to put useContext within a provider coming from an external event
body: <pre><code>const CounterContext = createContext();
  
  export function CounterProvider(props) {
    const [count, setCount] = createSignal(0),
      store = [
        count
      ];
  
    return (
      &lt;CounterContext.Provider value={store}&gt;
        {props.children}
      &lt;/CounterContext.Provider&gt;
    );
  }
  
  export function useCounter() { return useContext(CounterContext); }
  </code></pre>
  <p>I want to use this <code>useCounter</code> outside of the provider, after an external event like a <code>setTimeout</code> or an incoming Websocket message.</p>
  <pre><code>setTimeout(() =&gt; {
    const [count] = useCounter();
    createEffect(on(count, () =&gt; {
      console.log(count)
    }))
  })
  </code></pre>
  <p>This seems like a bad idea, but I have this in my application code, and I don't know how to restructure my code to avoid this.</p>