solid-primitives icon indicating copy to clipboard operation
solid-primitives copied to clipboard

JSX Tokenizer: add tokens which can be parsed using `children`

Open thetarnav opened this issue 1 year ago • 9 comments

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.

thetarnav avatar Apr 13 '23 15:04 thetarnav