Refs - clear input
How do I make an refs - clear input?
What is a refs - clear input? How do you make a refs - clear input? This script and codes were developed by Dylan on 07 January 2023, Saturday.
Refs - clear input - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Refs - clear input</title>
</head>
<body> <div id="app"></div> <script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.4.2/react.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.4.2/react-dom.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Refs - clear input - 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(props) { _classCallCheck(this, App); var _this = _possibleConstructorReturn(this, _React$Component.call(this, props)); _this.state = { data: '' }; _this.updateState = _this.updateState.bind(_this); _this.clearInput = _this.clearInput.bind(_this); return _this; } App.prototype.updateState = function updateState(e) { this.setState({ data: e.target.value }); }; App.prototype.clearInput = function clearInput() { this.setState({ data: '' }); ReactDOM.findDOMNode(this.refs.myInput); }; App.prototype.render = function render() { return React.createElement( 'div', null, React.createElement('input', { value: this.state.data, onChange: this.updateState, ref: 'myInput' }), React.createElement( 'button', { onClick: this.clearInput }, 'CLEAR' ), React.createElement( 'h4', null, this.state.data ) ); }; return App;
}(React.Component);
ReactDOM.render(React.createElement(App, null), document.getElementById('app'));
Developer | Dylan |
Username | thommyboy02 |
Uploaded | January 07, 2023 |
Rating | 3 |
Size | 2,614 Kb |
Views | 6,072 |
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 |
State change | 2,691 Kb |
Time React | 2,581 Kb |
LinkBot | 2,267 Kb |
Portfolio page | 4,382 Kb |
Refs | 2,445 Kb |
React - changing state | 2,576 Kb |
Egghead tute | 3,188 Kb |
A Pen by Dylan | 2,220 Kb |
State - mapping through data | 2,840 Kb |
SetState | 2,923 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 |
Tree growth tests | Orchard | 3,818 Kb |
Cut and Paste Roll Link | BottomlineInteractive | 2,546 Kb |
Experiments with Vertical Centering | KatieK2 | 3,924 Kb |
Button shaking | SusanneLundblad | 2,227 Kb |
Working around OS X Dynamic Scrollbars | Jrjenk | 2,279 Kb |
Text Blocks Over Image, Updated | KatieK2 | 3,122 Kb |
Css color for svg | Ademilter | 2,392 Kb |
We Simplify animation | Meodai | 48,169 Kb |
A Pen by John Malc | F789gh | 1,420 Kb |
Stylize Stories | Jvhti | 2,465 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!