Skip to content

JSX

Goal: Write components with JSX enabled.

Enable JSX in superjs.config.json ("jsx": true) or use the .sjsx extension. JSX lowers to your configured factory (e.g. React.createElement).

Example

// Save as component.sjsx with jsx enabled
export function Greeting(props: { name: string }): dynamic {
  return <p>Hello, {props.name}</p>
}

Open in playground

Key takeaways

  • JSX requires jsx mode — not valid in plain .sjs by default.
  • Props are usually a structural object type.
  • See specs/language/039-jsx.md for factory config.

Next: Calling JS from SJS

Documentation