This package has been deprecated

Author message:

Use vanilla-jsx@3 instead

vanilla-jsx-node

2.0.2 • Public • Published

Vanilla-JSX-Node

Vanilla-JSX-Node is the node version of the Vanilla-JSX library. This library allows you to render your views written for the browser to string, server side.

Features

  • Works without any DOM in env
  • Renders JSX to string
  • Translates className attribute into class

API

// Responsible for creating HTML Elements from JSX
export function jsx(name, attributes, ...children): Object {}
// To be executed on result from JSX method
export function process(element): string {}

Example

'use babel'

import vanilla from 'vanilla-jsx-node'
/** @jsx vanilla.jsx */

export class Message {
  constructor(message) {
    this.element = Message.getElement()
    console.log(typeof this.element === 'string')
    // ^ true!
  }
  static getElement(message) {
    return vanilla.process(<div>
      <span>{message.name}</span>
      <span>{message.text}</span>
      <span>{message.filePath}</span>
      {message.trace.map(Message.getElement)}
    </div>)
  }
}

LICENSE

This project is licensed under the terms of MIT License, See the LICENSE file for more info

Readme

Keywords

Package Sidebar

Install

npm i vanilla-jsx-node

Weekly Downloads

0

Version

2.0.2

License

MIT

Last publish

Collaborators

  • steelbrain