solid-primitives
solid-primitives copied to clipboard
JSX Tokenizer: add tokens which can be parsed using `children`
Describe The Problem To Be Solved
Currently, the component returned by createToken
will return a function element. This way we can display a friendly warning in the console if something tries to render the token, instead of an error from trying to insert a non-JSX.Element
type.
The downside of that approach is that the token elements cannot be passed to a context provider, transition-group, or anything that tries to resolve the children using the children
helper, even if it doesn't necessarily render anything yet.
So we lose a bit of functionality, and composition value, for a nicer misuse warning.
Suggest A Solution
I see this being implemented in two ways.
Either the createToken
component will be returning an object, instead of a function if the fallbackFn
param is not provided.
Or there could be createToken
and createRenderableToken
as separate functions.