Tell us what’s happening:
Hi all, I think for this project I did user story #1- #10 and only didn’t do #11. I am writing this on local machine (I started a react-app and wrote everything in App.js). However, when I copy and paste the code to codepen and run test, I failed all unit tests. Could you all please help me with the problem? Thanks! It works when I’m using my local host.
Your code so far
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
num : 0
}
this.generateNewQuote = this.generateNewQuote.bind(this);
}
generateNewQuote() {
this.setState({
num : Math.floor(Math.random() * 5)
});
}
render() {
return (
<div id ="quote-box">
<div id="text">{text[this.state.num]}</div>
<div id="author">{author[this.state.num]}</div>
<button id="new-quote" onClick={this.generateNewQuote} >New Quote</button>
<a id="tweet-quote" href={"//www.twitter.com/intent/tweet?text=" +
text[this.state.num] + " " + author[this.state.num]}>Tweet quote</a>
</div>
);
}
}
const text = ["The fall of dropping water wears away the Stone.","There are three things you can do in a baseball game. You can win, or you can lose, or it can rain.","Believe and act as if it was impossible to fail.","Televesion is the chewing gum of the eye.","Creativity is allowing yourself ot make mistakes. Art is knowing which ones to keep."];
const author = ["- Lucretius","- Caset Stengel","- Charles Kettering","- Frank Lloyd Wright","- Scott Adams"];
export default App;
Your browser information:
User Agent is: Version 70.0.3538.102 (Official Build) (64-bit)
.