Tenía un proyecto de generador de cotizaciones y necesitaba incluirlo en el proyecto nativo de reacción, pero no sé cómo usarlo. ¿Cómo puedo arreglar esto? ¿Cómo puedo escribir esta sección como reaccionar nativo?
<div class="container-fluid"> <div class="row p-2 justify-content-center"> <div class="col-md-6 d-flex justify-content-center align-items-center"> <textarea readOnly class="quote" id="input"></textarea> </div> <div class="col-md-3 d-flex justify-content-center align-items-center mt-2"></div> </div> </div> <button id="copy">Copy</button><br></br> <button class="btn btn-primary" type="submit" id="tweetButton">Tweet</button> <div class="loader" id="loader"></div> <script src="getQuote.js"></script>Cotizar Códigos del Generador...
$(document).ready(function(){ var randomQuote, randomAuthor; getQuote(); function getQuote(){ var quotes = ["It's not my fault.", "Your focus determines your reality.", "Do. Or do not. There is no try.", "In my experience there is no such thing as luck.", "Fear leads to anger, anger leads to hate, hate leads to suffering.", "Women always figure out the truth. Always."] var authors = ["- Han Solo", "– Qui-Gon Jinn", "-Yoda", "- Obi-Wan Kenobi", "-Yoda", "- Han Solo"] var number = Math.floor((Math.random()*quotes.length)); randomQuote = quotes[number]; randomAuthor = authors[number]; $(".quote").text(randomQuote); //$(".author").text(randomAuthor);};
function copy() { var copyText = document.querySelector("#input"); copyText.select(); document.execCommand("copy"); document.getElementById('copy').innerHTML="copied";}
var el = document.getElementById('copy'); if(el){ el.addEventListener('click', copy);}
$("#quoteButton").on("click", function(){ getQuote();});