Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/johnsi15/example-react-jsx-esm
https://github.com/johnsi15/example-react-jsx-esm
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/johnsi15/example-react-jsx-esm
- Owner: johnsi15
- License: mit
- Created: 2023-04-24T19:29:47.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-04-24T19:44:39.000Z (over 1 year ago)
- Last Synced: 2024-04-15T03:00:05.103Z (7 months ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Example react ESM with esm.sh
The script has to be of type module ` `
# [CDN](https://esm.sh/)
# [ESM](https://lenguajejs.com/javascript/modulos/que-es-esm/)
```javascript
import React from "https://esm.sh/[email protected]"
import ReactDOM from "https://esm.sh/[email protected]/client"const appElement = document.getElementById('app')
const root = ReactDOM.createRoot(appElement)
const el = React.createElement("section",{class:"container"},React.createElement("h3",null,"Hello world"));
root.render(el)
```
```javascript
// main.js
import React from 'https://esm.sh/[email protected]'
import ReactDOM from 'https://esm.sh/[email protected]/client'import App from './App.js'
const el = React.createElement(App, null)
ReactDOM.createRoot(document.getElementById('app')).render(el)
```
```javascript
// App.js
import React from 'https://esm.sh/[email protected]'function HolaMundo() {
return React.createElement(
'div',
{ className: 'hola' },
React.createElement('h3', null, 'Hola mundo')
)
}export default HolaMundo
```