Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
react-to-jsx
Advanced tools
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.
npm install react-to-jsx
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);
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.
FAQs
Generates a JSX string representation of React elements
The npm package react-to-jsx receives a total of 544 weekly downloads. As such, react-to-jsx popularity was classified as not popular.
We found that react-to-jsx demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.