1.1.1 • Published 4 years ago

amphtml-tsx v1.1.1

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

amphtml-tsx

Transform tsx to AMP HTML string

Setup

tsconfig.json

{
  "compilerOptions": {
    "jsx": "react",
    "jsxFactory": "pragma"
  }
}

Usage

import { pragma } from 'amphtml-tsx'

const renderToString = (name: string) => (
  <div class="one two three">
    <p id="line">
      Hello, {name}!
    </p>
  </div>
)

console.log(renderToString('world'))
// => <div class="one two three"><p id="line">Hello, world!</p></div>