Refs - clear input

Developer
Size
2,614 Kb
Views
6,072

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 Previews

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'));
Refs - clear input - Script Codes
Refs - clear input - Script Codes
Home Page Home
Developer Dylan
Username thommyboy02
Uploaded January 07, 2023
Rating 3
Size 2,614 Kb
Views 6,072
Do you need developer help for Refs - clear input?

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!

Dylan (thommyboy02) Script Codes
Create amazing captions 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!