Documentation example of context with typescript does not work
I copied the context example (CounterContext) from the docs to a solid start project. The first error I get is when I pass the store to the Context Provider value: "Type '({ count: any; } | { increment(): void; decrement(): void; })[]' is not assignable to type '({ count: number; } | { count?: undefined; })[]'". Then when I use the useContext example I get the following error "Property 'increment' does not exist on type '{ count: number; } | { count?: undefined; }'" (same for decrement) and when I try to call increment I get "increment is not a function". I am totally confused of how to make an actually simple thing like context (at least in React) work in Solid. Is there a bug or are the docs not up to date or does context not work with solid start (SSR)?
4 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
SolidJS
Solid is a purely reactive library. It was designed from the ground up with a reactive core. It's influenced by reactive principles developed by previous libraries.
I discovered that there is a more advanced example of a context implementation in the "examples" section. I might give that a shot. But nevertheless I would be great if the examples in the docs would work anyway.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View