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

react-to-jsx

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-to-jsx

Generates a JSX string representation of React elements

  • 1.3.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
868
increased by2.12%
Maintainers
1
Weekly downloads
 
Created
Source

React to JSX

Generates a JSX string representation of React elements. Takes a React Element (or an array of React Elements). Useful for generating React component style guides.

Usage

Install

npm install react-to-jsx

Basic Usage

var reactToJsx = require('react-to-jsx');

var jsxString = reactToJsx(
  <Button
    type="submit"
    size="large">
    Cool Button
  </Button>
);

// <Button
//   type="submit"
//   size="large">
//   Cool Button
// </Button>

console.log(jsxString);

Options

reactToJsx takes an optional options object: reactToJsx(reactElement, options).

indent

Type: String Default: '\t' (Tab)

Sets the indent string for returned JSX. Should probably match your preferred code style. Two spaces? Four? Three? The choice is yours, friend.

includeNull

Type: 'Boolean' Default: true

Determines whether to include props with a value of null in the returned JSX.

exclude

Type: Array Default: []

Array of props to exclude from the returned JSX. Hide those weird props, they shouldn't be in your docs anyway.

Keywords

FAQs

Package last updated on 11 Jun 2015

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