Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <!-- Bootstrap CSS -->
<link rel="stylesheet" href="">

<!-- Font Awesome CSS -->
<link rel="stylesheet" href="">

<!-- React app root div -->
<div id="root"></div>

<!-- React 17 dev js -->
<script crossorigin src=""></script>

<!-- ReactDOM 17 dev js -->
<script crossorigin src=""></script>

<!-- Bootstrap js -->
<script crossorigin src=""></script>

<!-- freeCodeCamp project testing js -->
<script src=""></script>


                @import url('');
@import url('');

/* colors */
$white: #fafafa;
$blue: #58f;
$black: #3f3f3f;

html, body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;

#root {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: $blue;
  height: 100vh;

#quote-box {
  padding: 2em;
  background-color: $white;
  margin: 20%;
  border-radius: 10px;
  color: $black;

  #text {
    font-family: 'Amiri', serif;
  #author {
    font-family: 'Neucha', cursive;
    font-size: 2.5em;
  .btn-row {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    #tweet-quote {
      margin-left: 1em;


                const QuoteBox = (props) => {
  return (
    <div id="quote-box">
      <h1 id="text">
        <i className="fa fa-quote-left"></i> {props.quote}
      <p id="author">- {}</p>

const App = () => {
  const [loading, setLoading] = React.useState(true)
  const [quote, setQuote] = React.useState({})
  const [quoteList, setQuoteList] = React.useState([])
  const getNewQuote = () => {
    const idx = Math.floor(Math.random() * quoteList.length)
    const newQuote = quoteList[idx]
  React.useEffect(() => {
    const fetchData = async () => {
      const quotesURL = ''
      const response = await fetch(quotesURL)
      const quotes = await response.json()
      const idx = Math.floor(Math.random() * quotes.quotes.length)
      const newQuote = quotes.quotes[idx]
  }, [])

  if (loading) {
    return <div>loading...</div>
  } else {
    const tweetURL = `${quote.quote} --${}`
    return (
      <QuoteBox quote={quote.quote} author={}>
        <div className="btn-row">
          <button className="btn btn-primary" id="new-quote" onClick={getNewQuote}>
            New quote
            className="btn btn-secondary"
            <i className="fa fa-twitter"></i> Tweet

ReactDOM.render(<App />, document.getElementById("root"));