jsx-to-string
jsx-to-string copied to clipboard
Option to put props on single line
Hi, cool library. It turned out to be exactly what I was looking for today. Anyway, I noticed that the JSX string adds line breaks between props when the component has children. This leads to somewhat awkward looking strings.
For example,
jsxToString(<Something propA propB>Another thing</Something>, {
shortBooleanSyntax: true
});
/*
Outputs:
<Something propA
propB>
Another thing
</Something>
*/
My proposal is to add an option to put props on one line. For example,
jsxToString(<Something propA propB>Another thing</Something>, {
shortBooleanSyntax: true,
singleLineProps: true
});
/*
Outputs:
<Something propA propB>
Another thing
</Something>
*/
It looks like a pretty simple fix, so I may just go ahead and submit a PR.