React-motion test
How do I make an react-motion test?
What is a react-motion test? How do you make a react-motion test? This script and codes were developed by Paul Sherman on 10 November 2022, Thursday.
React-motion test - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>react-motion test</title>
</head>
<body> <div id='root'></div> <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='https://unpkg.com/react-motion/build/react-motion.js'></script>
<script src='https://unpkg.com/[email protected]/umd/react-router.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
React-motion test - Script Codes JS Codes
"use strict";
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
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; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var _React = React;
var Component = _React.Component;
var _ReactDOM = ReactDOM;
var render = _ReactDOM.render;
var _ReactRouter = ReactRouter;
var BrowserRouter = _ReactRouter.BrowserRouter;
var Match = _ReactRouter.Match;
var Link = _ReactRouter.Link;
var _ReactMotion = ReactMotion;
var TransitionMotion = _ReactMotion.TransitionMotion;
var spring = _ReactMotion.spring;
var styles = { fill: { position: 'relative', top: 0, left: 0 }
};
var MatchWithFade = function MatchWithFade(_ref) { var Component = _ref.component; var rest = _objectWithoutProperties(_ref, ["component"]); var willLeave = function willLeave() { return { zIndex: 1, opacity: spring(0) }; }; return React.createElement(Match, _extends({}, rest, { children: function children(_ref2) { var matched = _ref2.matched; var props = _objectWithoutProperties(_ref2, ["matched"]); return React.createElement( TransitionMotion, { willLeave: willLeave, styles: matched ? [{ key: rest.pattern, style: { opacity: 1 }, data: props }] : [] }, function (interpolatedStyles) { return React.createElement( "div", null, interpolatedStyles.map(function (config) { return React.createElement( "div", { key: config.key, style: _extends({}, styles.fill, config.style) }, React.createElement(Component, config.data) ); }) ); } ); } }));
};
var TwoOne = function TwoOne() { return React.createElement( "div", null, "Two One" );
};
var TwoTwo = function (_Component) { _inherits(TwoTwo, _Component); function TwoTwo() { _classCallCheck(this, TwoTwo); return _possibleConstructorReturn(this, _Component.apply(this, arguments)); } TwoTwo.prototype.componentWillUnmount = function componentWillUnmount() { console.log("TwoTwo will unmount"); }; TwoTwo.prototype.componentWillMount = function componentWillMount() { console.log("TwoTwo will mount"); }; TwoTwo.prototype.render = function render() { return React.createElement( "div", null, "Two Two" ); }; return TwoTwo;
}(Component);
var TwoHome = function TwoHome() { return React.createElement( "div", null, "Two Home" );
};
var One = function (_Component2) { _inherits(One, _Component2); function One() { _classCallCheck(this, One); return _possibleConstructorReturn(this, _Component2.apply(this, arguments)); } One.prototype.componentWillUnmount = function componentWillUnmount() { console.log("ONE UNMOUNTING"); }; One.prototype.render = function render() { return React.createElement( "div", { style: { width: 300, border: '1px solid black', backgroundColor: 'orange', minHeight: 200 } }, "One one one one one one one one one one", React.createElement("br", null), "One one one one one one one one one one", React.createElement("br", null) ); }; return One;
}(Component);
var Two = function Two() { var colors = ['red', 'green', 'yellow']; var bgColor = colors[Math.floor(Math.random() * colors.length)]; return React.createElement( "div", { style: { width: 300, border: '1px solid black', backgroundColor: 'yellow', minHeight: 200 } }, React.createElement(Match, { pattern: "/two/one", component: TwoOne }), React.createElement(Match, { pattern: "/two/two", component: TwoTwo }), React.createElement(Match, { pattern: "/two(/)?", exactly: true, component: TwoHome }) );
};
var App = function (_Component3) { _inherits(App, _Component3); function App() { _classCallCheck(this, App); return _possibleConstructorReturn(this, _Component3.apply(this, arguments)); } App.prototype.render = function render() { return React.createElement( BrowserRouter, null, React.createElement( "div", { style: { padding: 12 } }, React.createElement( "div", { style: { marginBottom: 12 } }, React.createElement( Link, { to: "/one" }, "One" ), " || ", React.createElement( Link, { to: "/two" }, "Two" ), "|| ", React.createElement( Link, { to: "/two/one" }, "Two One" ), "|| ", React.createElement( Link, { to: "/two/two" }, "Two Two" ) ), React.createElement( "div", { style: { position: 'relative' } }, React.createElement(MatchWithFade, { pattern: "/one", component: One }), React.createElement(MatchWithFade, { pattern: "/two", component: Two }) ) ) ); }; return App;
}(Component);
render(React.createElement(App, null), document.getElementById('root'));
Developer | Paul Sherman |
Username | pshrmn |
Uploaded | November 10, 2022 |
Rating | 3 |
Size | 4,241 Kb |
Views | 16,192 |
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 |
React Router Global 404 | 3,443 Kb |
Update with search | 2,275 Kb |
CSSTransitionGroup Example | 3,255 Kb |
RRC wrapSwitch | 2,922 Kb |
NavLinks | 2,391 Kb |
Prompt Test | 3,925 Kb |
A Pen by Paul Sherman | 2,254 Kb |
A Simple React Router v4 Tutorial | 4,282 Kb |
RRv3 Walk | 2,991 Kb |
React Router with Redux | 4,033 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 |
Drop Cap | Gsaiki | 1,571 Kb |
Disable JavaScript execution from console | Ludviglindblom | 2,534 Kb |
Simple personal profile | Miroot | 2,856 Kb |
Exploring css spinners | Akagr | 3,569 Kb |
Birthday Party Starter | Aussieyang | 1,629 Kb |
Local Weather App - FreeCodeCamp | TrevorWelch | 4,134 Kb |
Ipad Mini Showcase | Hornebom | 10,479 Kb |
Em Test | Rodesco | 1,784 Kb |
Voting App - register | MatheusLima92 | 1,948 Kb |
A Pen by Bryan Rojas | Bryanrojas | 1,873 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!