1.0.1 • Published 2 years ago
jsxtoastring v1.0.1
jsxtoastring
This package converts JSX elements to strings. There is no header needed, just importing.
This library is helpful to create apps that use a lot of raw HTML strings, so this can give syntax highlighting.
Components
Of course, components work as you expect. They support props
and other things. Only issue is there no hooks, and every component must be a function.
Example
Here is an example of the usage of the library:
function Welcome(props) {
return <h1>Welcome, {props.name}!</h1>
}
document.body.innerHTML += <Welcome name="Brahma"></Welcome>
Note the document.body.innerHTML +=
. That is used because this library does not have a render function.
No JSX?
Well, you can always use React.createElement
in this library.