New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

jsx0

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsx0

JSX string to React component converter

latest
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

jsx0

JSX string to React component converter

npm i jsx0
import jsx0 from 'jsx0'

const src = `<h1>{props.children}</h1>`

const Heading = jsx0(src)

// <Heading>Hello</Heading>

Scope

An object of scoped variables can be passed as a second argument for things like creating composite components.

import React from 'react'
import jsx0 from 'jsx0'

const Box = props => <div {...props} />
const Image = props => <img {...props} />
const Text = props => <p {...props} />

const Card = jsx0(`
<Box>
  <Image src={props.image} />
  <Text children={props.text} />
</Box>`, {
  Box,
  Image,
  Text
})

:warning: Security

This is dangerous to use with user-generated content and in web applications. This library is primarily intended for sandboxed Node.js environments.

MIT License

Keywords

react

FAQs

Package last updated on 19 Sep 2017

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