I followed a tutorial and build my own simple react project but the links aren’t working. I followed a lot of tutorials on how to do it, but the results are the same
The web page just comes out blank. I don’t know if I’m missing something or not. I tried it on codepen and it works fine, but not with CDN links.
index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Random Quote Machine</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://kit.fontawesome.com/c2d871e1b7.js" crossorigin="anonymous"></script>
</head>
<body>
<div id="root"></div>
<script src="https://unpkg.com/react@17/umd/react.development.js" crossorigin></script>
<script src="https://unpkg.com/react-dom@17/umd/react-dom.development.js" crossorigin></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script type="text/babel" src="./script.js"></script>
</body>
</html>
script.js:
const quotes= [
{
quote:
"Life is too short and sweet to be spent by cribbing and complaining about things. Here are some random quotes about the most wonderful gift that we've got",
author: " Life"
},
{
quote: "Programming is not a science. Programming is a craft.",
author: "Richard Stallman"
},
{
quote: "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.",
author: "Linus Torvalds"
},
{
quote: "In real open source, you have the right to control your own destiny",
author: "Linus Torvalds"
},
{
quote: "We don't make mistakes; we just have happy accidents.",
author: "Bob Ross"
}
];
class Quote extends React.Component {
constructor(props) {
super(props);
this.state = {
quote: '----',
author: '----'
};
this.handleChange=this.handleChange.bind(this);
}
handleChange(){
let i= Math.floor(Math.random() * quotes.length)
this.setState({
quote: quotes[i].quote,
author: quotes[i].author
});
}
render() {
return (
<div>
<div id="quote-box" class="d-flex justify-content-center flex-nowrap">
<div id="text">
<button id="new-quote" onClick={this.handleChange}>Click Me</button>
<p>Quote: {this.state.quote}</p>
<div id="author">
<p>Author: {this.state.author}</p>
</div>
</div>
</div>
</div>
);
}
}
ReactDOM.render(<Quote />, document.getElementById('root'));
Here is the screenshot of the errors:
[1]: https://i.stack.imgur.com/fYdNe.png


