foolswisdom
@solidjs/router not working
It appears to you have your editor set to warn you when misspelled / unknown words are words. solidjs may not appear in the dictionary, but that makes it no less a valid package namespace, and
@solidjs/router
is the correct package name. This does not stop your package manager from installing it, or is simply the vscode extension warning that it doesn't know this word23 replies
Unable to provide context to children
It isn't clear where props.children was used. If it's in the same place as where the children are accessed / created in the above code, that would result in the same problem.
Or to restate the issue: the children helper does not change where the creation of children occurs, it's merely a helper to memoize so they're only created once. And the problem is that creating the children in the body of the component, above the jsx, is above the provider boundary.
13 replies
Unable to provide context to children
https://docs.solidjs.com/reference/component-apis/children#children
Towards the bottom (though it sadly doesn't call out the implications for context)
An important aspect of the children helper is that it forces the children to be created and resolved, as it accesses props.children immediately.
13 replies
Unable to provide context to children
The problem here is that the children are created early. Normally, props.children is a lazy access, so the children are created under the context provider boundary. In this case, you're eagerly accessing it in the solidChildren function (it's a wrapper around memo, which is eager). This means you're freaking the children outside the boundary.
13 replies
How are you supposed to satisfy refs when not forwarding to a pure DOM node?
I expect there's nothing built in. The types are often written with elements in mind, reusing them for components may not be feasible. In some cases it makes sense to adjust the existing types (make a PR), sometimes not
6 replies
How are you supposed to satisfy refs when not forwarding to a pure DOM node?
The ref prop received will be a function, even if the type passed to the ref prop is a variable (the compiler will simply create a function that takes a value and assigns to that variable). The Ref type allows for both, because it's defined in terms of the type that can be passed. If you don't like that, you should use a different type.
The reason the type includes undefined is because you explicitly added undefined to the type generic passed to Ref, so of course TS says it's possibly undefined
6 replies