React Play

Developer
Size
3,804 Kb
Views
32,384

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 Previews

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'));
React Play - Script Codes
React Play - Script Codes
Home Page Home
Developer Lucas Cawkell
Username cawsp
Uploaded September 09, 2022
Rating 3
Size 3,804 Kb
Views 32,384
Do you need developer help for React Play?

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!

Lucas Cawkell (cawsp) Script Codes
Create amazing blog posts 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!