ReactJS Simple Component

Size
2,540 Kb
Views
22,264

How do I make an reactjs simple component?

What is a reactjs simple component? How do you make a reactjs simple component? This script and codes were developed by Xavier Martínez on 19 September 2022, Monday.

ReactJS Simple Component Previews

ReactJS Simple Component - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>ReactJS Simple Component</title>
</head>
<body> <div id="app"></div> <script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react-dom.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/react/0.13.0/react.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

ReactJS Simple Component - Script Codes JS Codes

'use strict';
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var App = function (_React$Component) { _inherits(App, _React$Component); function App() { _classCallCheck(this, App); var _this = _possibleConstructorReturn(this, _React$Component.call(this)); _this.state = { val: 0, on: true }; _this.clicked = _this.clicked.bind(_this); return _this; } App.prototype.clicked = function clicked() { console.log('click!'); this.setState({ val: this.state.val + 1 }); }; App.prototype.render = function render() { return React.createElement( 'div', null, React.createElement( 'h1', null, 'Hello, ', this.props.name ), React.createElement( 'p', null, 'Click me!' ), React.createElement( 'button', { onClick: this.clicked }, this.state ), React.createElement( 'p', null, 'You clicked me ', this.state.val ) ); }; return App;
}(React.Component);
React.render(React.createElement(App, { name: 'Peter' }), document.getElementById('app'));
ReactJS Simple Component - Script Codes
ReactJS Simple Component - Script Codes
Home Page Home
Developer Xavier Martínez
Username xmjol
Uploaded September 19, 2022
Rating 3
Size 2,540 Kb
Views 22,264
Do you need developer help for ReactJS Simple Component?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Xavier Martínez (xmjol) Script Codes
Create amazing love letters with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!