Skip to content

Add as Attribute #125

@FrameMuse

Description

@FrameMuse

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 />
}

  • as Attribute can be introduced optionally
  • as Attribute can be used to Introduce React-compatible Components in TamaJs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions