Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/deseteral/stunning-jsx-renderer
Why do I keep putting this kind of stuff on GitHub...
https://github.com/deseteral/stunning-jsx-renderer
amazing deal-breaker game-changer shocking stunning wonderful
Last synced: 21 days ago
JSON representation
Why do I keep putting this kind of stuff on GitHub...
- Host: GitHub
- URL: https://github.com/deseteral/stunning-jsx-renderer
- Owner: Deseteral
- Created: 2018-10-03T21:03:05.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-24T22:55:02.000Z (over 4 years ago)
- Last Synced: 2024-11-09T21:08:25.603Z (3 months ago)
- Topics: amazing, deal-breaker, game-changer, shocking, stunning, wonderful
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# stunning-jsx-renderer
🎈 ☃️ 🎈 ⚡ 🎈 ️🍾 🎈 🗿 🎈
> Honestly it's not that stunning.
>
> Acutally it's very simple.
>
> And probably incorrect in some cases.Just don't use it for anything serious and you will be fine.
## What?
You put in JSX and out comes HTML string.```javascript
/** @jsx createElement */
const { renderToString, createElement } = require('./src/server-side');const html = renderToString(
This is amazing!
);console.log(html); // '
This is amazing!'
```There's also client-side version:
```javascript
/** @jsx createElement */domRender(
This is amazing!
document.body
);console.log(document.body.innerHTML); // '
This is amazing!'
```## Why?
I don't know, just wanted to try to figure out how JSX and [ReactDOMServer#RenderToStaticMarkup](https://reactjs.org/docs/react-dom-server.html#rendertostaticmarkup) and [ReactDOM#render](https://reactjs.org/docs/react-dom.html#render) works I guess?