Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

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

Packages

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.

Behavior

Save Automatically?

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.

HTML

              
                <div id="app"></app>
              
            
!

CSS

              
                html, body
  height: 100%
  
body
  background: #333
  display: flex
  justify-content: center
  align-items: center
  font-family: Helvetica Neue
  
h1
  font-size: 2em
  color: #eee
  display: inline-block

a
  color: white
p
  margin-top: 1em
  text-align: center
  color: #aaa
              
            
!

JS

              
                /*
 * A simple React example for using super(props)
 */
class Ankit extends React.Component {
   constructor(props){
   super(props);
     this.state = {
       test: "ankit"
     }
   console.log("from ankit, How are you?");
     this.testFunction = this.testFunction.bind(this);
  } 
  testFunction(){
    console.log("testFunction of parent class "+this.state.test);
  }
}

class Avantika extends Ankit {
  constructor(props){
    super(props);
    this.state = {
      test: "avantika"
    }
    console.log("from avantika,"+props.response);
  }
  
    componentDidMount(){
      super.testFunction();
      this.testFunction();
    }
  
    testFunction(){
    console.log("testFunction of child class "+this.state.test);
  }
  
  render() {
    return <div>
      <h1 onMouseEnter= {this.testFunction}>Open console to see super props in action</h1>
      
      <p>In console you will observe that constructor of Ankit class is executed first and then constructor of avantika class</p>
      <p>
        More info <a href="https://twitter.com/imAnkitkamboj/status/1203026393107324928?ref_src=twsrc%5Etfw" target="_blank">here</a>.
      </p>
    </div>;
  }
}

/*
 * Render the above component into the div#app
 */

React.render(<Avantika response={"I'm fine thank you."}/>, document.getElementById('app'));
              
            
!
999px

Console