Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

progfay/html-tsx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

html-tsx

Transform tsx to HTML string

Setup

tsconfig.json

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

Usage

import { pragma } from 'html-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>