0.1.4 • Published 3 years ago

babel-plugin-lit-jsx v0.1.4

Weekly downloads
7
License
ISC
Repository
github
Last release
3 years ago

lit-jsx

Write lit-html template literal with JSX


npm.io https://twitter.com/Shinyaigeek


Features

  • Write template literal in lit-html with JSX
  • Developer can receive the benefit of @types/react
  • Simple API

Installation

npm install babel-plugin-lit-jsx

or

yarn add babel-plugin-lit-jsx

Usage

  1. Add babel-plugin-lit-jsx to plugins in babel configuration file.
{
    "presets" : [...],
    // add babel-pplugin-lit-jsx plugin
    "plugins" : [..., "babel-plugin-lit-jsx"]
}
  1. Write Functional Component which doesn't depend on React.

ex)

import { BlogContent } from "./BlogContent";
import { render } from "lit-html";

interface Props {
    title: string;
    author: string;
    date: string;
    content: string;
}

const BlogPost = ({ title, author, date, content }: Props) => {
    return <div className="post"><main>
        <div className="title">{title}</div>
        <div className="author">{author}</div>
        <date className="date">{date}</date>
        <BlogContent content={content} />
    </main></div>
}

render(<BlogPost />, document.getElementById("_app"!))
0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.16

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.10

4 years ago

0.0.11

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago