React Play
How do I make an react play?
What is a react play? How do you make a react play? This script and codes were developed by Lucas Cawkell on 09 September 2022, Friday.
React Play - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>React Play</title> <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id="root" class="container-fluid">
</div> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react-dom.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
React Play - Script Codes CSS Codes
#root
{ width: 200px;
}
React Play - 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 formControls = [];
formControls.push({ StaticName: "FirstName", DisplayName: "First Name", LabelText: "Please enter your first name", Type: "text"
});
formControls.push({ StaticName: "LastName", DisplayName: "Last Name", LabelText: "Please enter your last name", Type: "text"
});
formControls.push({ StaticName: "Birthday", DisplayName: "Birthday", LabelText: "What is your birthday?", Type: "date"
});
formControls.push({ StaticName: "Address", DisplayName: "Address", LabelText: "What is your address?", Type: "text"
});
formControls.push({ StaticName: "Gender", DisplayName: "Gender", LabelText: "", Type: "radio", Choices: ["male", "female"], Default: ""
});
var SPRadio = function (_React$Component) { _inherits(SPRadio, _React$Component); function SPRadio(props) { _classCallCheck(this, SPRadio); return _possibleConstructorReturn(this, _React$Component.call(this, props)); } SPRadio.prototype.render = function render() { return React.createElement( "div", { "class": "radio" }, React.createElement( "label", null, React.createElement("input", { type: "radio", name: this.props.staticName, id: this.props.radioId, value: this.props.optionText, checked: this.props.checked }), this.props.optionText ) ); }; return SPRadio;
}(React.Component);
var SPControl = function (_React$Component2) { _inherits(SPControl, _React$Component2); function SPControl(props) { _classCallCheck(this, SPControl); return _possibleConstructorReturn(this, _React$Component2.call(this, props)); } SPControl.prototype.render = function render() { return React.createElement( "div", { className: "form-group" }, React.createElement( "label", { htmlFor: this.props.staticName }, this.props.labelText ), React.createElement("input", { type: this.props.controlType, className: "form-control", id: this.props.staticName, placeholder: "" }) ); }; return SPControl;
}(React.Component);
var SPForm = function (_React$Component3) { _inherits(SPForm, _React$Component3); function SPForm() { _classCallCheck(this, SPForm); return _possibleConstructorReturn(this, _React$Component3.apply(this, arguments)); } SPForm.prototype.render = function render() { return React.createElement( "div", null, React.createElement( "h1", null, "Order Form" ), React.createElement( "form", null, formControls.map(function (formControl) { var control = []; var displayName = formControl["DisplayName"]; var type = formControl["Type"]; var staticName = formControl["StaticName"]; var labelText = formControl["LabelText"]; var defaultVal = formControl["Default"]; console.log(type); if (type === "radio") { var choices = formControl["Choices"]; for (var i = 0; i < choices.length; i++) { control.push(React.createElement(SPRadio, { staticName: staticName, name: "Male", optionText: choices[i], checked: defaultVal === choices[i], radioId: staticName + i })); } } else { control = React.createElement(SPControl, { displayName: displayName, controlType: type, staticName: staticName, labelText: labelText }); } return control; }) ) ); }; return SPForm;
}(React.Component);
ReactDOM.render(React.createElement(SPForm, null), document.getElementById('root'));
Developer | Lucas Cawkell |
Username | cawsp |
Uploaded | September 09, 2022 |
Rating | 3 |
Size | 3,804 Kb |
Views | 32,384 |
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!
Name | Size |
A Pen by Lucas Cawkell | 1,536 Kb |
SurreyLibs | 3,665 Kb |
Cawkell Brodie | 4,294 Kb |
Cart Styles | 7,158 Kb |
Product Cards | 2,574 Kb |
Final Exam Travel Website | 1,991 Kb |
Fancy Test | 1,527 Kb |
Playing around | 1,824 Kb |
Spotlight People Display | 1,802 Kb |
Cart | 1,929 Kb |
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!
Name | Username | Size |
Arrow Navigation | Hinducows | 1,973 Kb |
TinFoil Boats | Chandralil | 4,577 Kb |
GLSL Hills | Ykob | 6,991 Kb |
Click handler test | Snapson | 2,329 Kb |
To Do List with Delete | Mattlbrody | 2,068 Kb |
Wikipedia API | Coderpilot | 2,802 Kb |
Scifi-style Radio-based Tab | Aaronchuo | 4,427 Kb |
Confirm Close Of Foundation Reveal Modal | Winghouchan | 1,818 Kb |
Disable JavaScript execution from console | Ludviglindblom | 2,534 Kb |
Simple Login Form | JoshBlackwood | 4,418 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!