html-tsx
TypeScript icon, indicating that this package has built-in type declarations

1.6.0 • Public • Published

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>

Package Sidebar

Install

npm i html-tsx

Weekly Downloads

5

Version

1.6.0

License

MIT

Unpacked Size

13.9 kB

Total Files

6

Last publish

Collaborators

  • progfay