Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jsx-string

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsx-string

JSX in, strings out

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

JSX-String

JSX-string is a cool module that allows you to write JSX and receive strings out of it. The main benefits include writing XML as JSX.

Because React by design doesn't support colons (:) in attribute and tags, just write a_b and it'll be converted to a:b

Installation

npm install --save jsx-string

Types


export type Options = {
  escape: boolean = false,
};
export default function jsx(input: any, options: Options);
export function h(...);

Usage

import jsxString, { h } from 'jsx-string'

/** @jsx h */
// ^ tell babel to route all JSX calls to that function

const username = 'someone'
const query = jsxString(
  <methodCall>
    <param>{username}</param>
  </methodCall>,
  {
    escape: false,
  },
)
console.log(typeof query) // 'string'

License

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

FAQs

Package last updated on 20 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc