TweetBox with React JS
How do I make an tweetbox with react js?
First contact with React JS through the creation of a Twitter Tweet Box. What is a tweetbox with react js? How do you make a tweetbox with react js? This script and codes were developed by Jose Sentis on 08 September 2022, Thursday.
TweetBox with React JS - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>TweetBox with React JS</title> <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id="app" class="container"> <div id="container">Hola</div>
</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>
TweetBox with React JS - Script Codes CSS Codes
body { padding: 30px 0; color: #000; background-color: #f2f2f2;
}
TweetBox with React JS - Script Codes JS Codes
"use strict";
var TweetBox = React.createClass({ displayName: "TweetBox", getInitialState: function getInitialState() { return { text: "", photoAdded: false, maxChar: 140 }; }, handleChange: function handleChange(event) { this.setState({ text: event.target.value }); }, togglePhoto: function togglePhoto(event) { this.setState({ photoAdded: !this.state.photoAdded }); }, remainingCharacters: function remainingCharacters() { if (this.state.photoAdded) { return 140 - 23 - this.state.text.length; } else { return 140 - this.state.text.length; } }, overflowAlert: function overflowAlert() { if (this.remainingCharacters() < 0) { if (this.state.photoAdded) { var beforeOverflowText = this.state.text.substring(140 - 23 - 10, 140 - 23); var overflowText = this.state.text.substring(140 - 23); } else { var beforeOverflowText = this.state.text.substring(140 - 10, 140); var overflowText = this.state.text.substring(140); } return React.createElement( "div", { className: "alert alert-warning" }, React.createElement( "strong", null, "Oops! Too Long:" ), " ...", beforeOverflowText, React.createElement( "strong", { className: "bg-danger" }, overflowText ) ); } else { return ""; } }, render: function render() { return React.createElement( "div", { className: "well clearfix" }, this.overflowAlert(), React.createElement("textarea", { className: "form-control", onChange: this.handleChange }), React.createElement("br", null), React.createElement( "span", null, this.remainingCharacters() ), React.createElement( "button", { className: "btn btn-primary pull-right", disabled: this.remainingCharacters() === 140 }, "Tweet" ), React.createElement( "button", { className: "btn btn-default pull-right", onClick: this.togglePhoto }, this.state.photoAdded ? "✓ Photo Added" : "Add Photo" ) ); }
});
ReactDOM.render(React.createElement(TweetBox, null), document.getElementById("container"));
Developer | Jose Sentis |
Username | j0zelito |
Uploaded | September 08, 2022 |
Rating | 3 |
Size | 3,325 Kb |
Views | 22,264 |
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 |
Refreshing CSS summer popsicles | 2,718 Kb |
Old Cassette CSS illustration | 3,447 Kb |
Shoe Box CSS illustrated | 5,209 Kb |
CSS Summer vibes | 3,846 Kb |
Speaker CSS illustration and animation. | 3,690 Kb |
GameBoy CSS Illustration | 3,880 Kb |
Burger CSS Illustration | 6,730 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 |
STAR WARS LIGHTSABER | Francoiscoron | 4,420 Kb |
Image Hover | Johnheiner | 3,409 Kb |
Animate elements with fixed gradient | Badabam | 4,406 Kb |
BenU Maintenance Site | Ksherman | 4,893 Kb |
Tab panels | Accessibility | 0 Kb |
Electric worm | Jeffibacache | 2,377 Kb |
Improve | Gavra | 1,652 Kb |
Cloudy Spiral CSS animation | Hakimel | 6,587 Kb |
RWD Conversion Practice | Jxqr97 | 2,743 Kb |
Simple Flat Menu | Jeplaa | 2,467 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!