This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dom from 'jsx-render'; | |
class Test { | |
constructor() | |
{ | |
var app = document.getElementById('app') | |
var htmlCreatedByJSXRender = dom('h1', {}, 'Test Class'); | |
app.appendChild(htmlCreatedByJSXRender); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
</head> | |
<body> | |
<div id="app"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"start": "webpack --watch" | |
}, | |
"dependencies": { }, | |
"devDependencies": { } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test | |
{ | |
constructor() | |
{ | |
console.log('Test class successfully initialized'); | |
} | |
} | |
new Test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root | |
|-- node_modules | |
|-- ... | |
|-- src | |
|-- index.js | |
|-- .babelrc | |
|-- index.html | |
|-- package.json | |
|-- webpack.config.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
module.exports = { | |
entry: path.resolve(__dirname, 'src', 'index.js'), // Main file will be at ./src/index.js | |
output: { | |
path: path.resolve(__dirname, 'build'), | |
filename: 'bundle.js' // Bundled file will be at ./build/bundle.js | |
}, | |
module: { | |
rules: [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"plugins": [ | |
["@babel/plugin-transform-react-jsx", { | |
"pragma": "dom" | |
}] | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Reactbone, { Component } from './Reactbone'; | |
class Test extends Component | |
{ | |
constructor() | |
{ | |
super(); | |
this.view('#app'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dom from 'jsx-render'; | |
const Reactbone = (tagname, attrs, ...children) => dom(tagname, attrs, ...children); | |
export default Reactbone; | |
export class Component { | |
view(el) | |
{ | |
const $el = document.querySelector(el); | |
$el.appendChild(this.render()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yarn add backbone underscore webpack webpack-cli babel-loader @babel/core @babel/plugin-transform-react-jsx jsx-render |