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
{ | |
"presets": [ | |
"@babel/preset-env", | |
"@babel/preset-react" | |
] | |
} |
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 React from 'react'; | |
import ReactDOM from 'react-dom'; | |
class App extends React.Component { | |
render() { | |
return ( | |
<h1>Welcome to REACT!</h1> | |
) | |
} | |
} |
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="root"></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
{ | |
"name": "react_starter", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"build": "webpack", | |
"start": "webpack-dev-server --watch" | |
}, | |
"keywords": [], |
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: './src/app.js', | |
output: { | |
filename: 'bundle.js', | |
path: path.join(__dirname, 'public') | |
}, | |
module: { | |
rules: [{ | |
loader: 'babel-loader', |
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 JSXDemo extends React.Component { | |
render() { | |
return <h1>This is JSX</h1>; | |
} | |
} | |
ReactDOM.render(<JSXDemo />, document.getElementById('root')); |
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 JSXDemo extends React.Component { | |
render() { | |
return React.createElement("h1", null, "This is JSX"); | |
} | |
} |
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 JSXDemo extends React.Component { | |
render() { | |
const jsx = <h1>This is JSX</h1>; | |
console.log(jsx); | |
return jsx; | |
} | |
} | |
ReactDOM.render(<JSXDemo />, document.getElementById('root')); |
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 JSXDemo extends React.Component { | |
handleOnClick = () => { | |
} | |
render() { | |
return <button id="btn" onClick={this.handleOnClick}>Click Here</button>; | |
} | |
} | |
ReactDOM.render(<JSXDemo />, document.getElementById('root')); |
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 JSXDemo extends React.Component { | |
render() { | |
return <h1 class="user-name">{this.props.name}</h1>; | |
} | |
} | |
ReactDOM.render(<JSXDemo name="John"/>, document.getElementById('root')); |