/*Downloaded from https://www.codeseek.co/08licia/a-pen-by-alicia-PmmvrM */
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
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 Profile = function (_React$Component) {
_inherits(Profile, _React$Component);
function Profile() {
_classCallCheck(this, Profile);
return _possibleConstructorReturn(this, (Profile.__proto__ || Object.getPrototypeOf(Profile)).apply(this, arguments));
}
_createClass(Profile, [{
key: "render",
value: function render() {
return React.createElement(
"div",
null,
React.createElement(
"h3",
null,
this.props.name
),
React.createElement(
"p",
null,
this.props.age,
" years"
)
);
}
}]);
return Profile;
}(React.Component);
var Hobby = function (_React$Component2) {
_inherits(Hobby, _React$Component2);
function Hobby() {
_classCallCheck(this, Hobby);
return _possibleConstructorReturn(this, (Hobby.__proto__ || Object.getPrototypeOf(Hobby)).apply(this, arguments));
}
_createClass(Hobby, [{
key: "render",
value: function render() {
return React.createElement(
"div",
{ className: "hobbies" },
React.createElement(
"ul",
null,
this.props.hobbies.map(function (hobby, index) {
return React.createElement(
"li",
{ key: index },
hobby
);
})
)
);
}
}]);
return Hobby;
}(React.Component);
var App = function (_React$Component3) {
_inherits(App, _React$Component3);
function App() {
_classCallCheck(this, App);
return _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).apply(this, arguments));
}
_createClass(App, [{
key: "render",
value: function render() {
return React.createElement(
"div",
null,
React.createElement(Profile, { name: this.props.profileData.name, age: this.props.profileData.age }),
React.createElement(Hobby, { hobbies: this.props.profileData.hobbies })
);
}
}]);
return App;
}(React.Component);
var data = { name: "John Doe",
age: 54,
hobbies: ['skiing', 'watching TV', 'playing golf'] };
ReactDOM.render(React.createElement(App, { profileData: data }), document.getElementById("app"));