-
Notifications
You must be signed in to change notification settings - Fork 10
Add as Attribute #125
Copy link
Copy link
Open
Labels
Milestone
Description
Sketches
Sketch of optional activation of this feature
const inflator = new WebInflator
inflator.jsxAttributes.add(JSXCustoms.AsAttribute)Example as Wrapper
function Component() {
return (
<div as={WrapperComponent}>
<h2>Title</h2>
<p>Description</p>
</div>
)
}
function WrapperComponent(props: { children: unknown }) {
return <section>{props.children}</section>
}Example as Context Provider
function Component() {
return (
<div as={ContextComponent}>
<h2>Title</h2>
<p>Description</p>
</div>
)
}
class Context { }
function ContextComponent(this, props: { children: unknown }) {
this.tree.context.require(new Context)
return props.children
}import { useState } from "react"
function Component() {
return (
<react as={ReactComponent}>
<h2>Title</h2>
<p>Description</p>
</react>
)
}
function ReactComponent() {
useState(123)
return <div />
}asAttribute can be introduced optionallyasAttribute can be used to Introduce React-compatible Components in TamaJs
Reactions are currently unavailable