cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

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.

            
              @import url(https://fonts.googleapis.com/css?family=Roboto:100);

h2 {
  font-family: 'Roboto', sans-serif;
  font-weight: 100;
}

button {
	background-color:transparent;
	-moz-border-radius:5px;
	-webkit-border-radius:5px;
	border-radius:5px;
	border:1px solid #bdbdbd;
	display:inline-block;
	cursor:pointer;
	color:#bdbdbd;
	font-family:Arial;
	font-size:16px;
	padding:10px 20px;
  margin-right: 8px;
	text-decoration:none;
  transition: all 0.4s ease;
}
button:hover {
	color: #76daff;
  border: 1px solid #76daff;
}
button:focus {
  outline: 0;
}

            
          
!
            
              class Counter extends React.Component {
  constructor(props){
    super(props);
    
    this.state = {
      currentCount: 0
    }
  }
  
  // Basic parent increment handler
  increment() {
    this.setState({
      currentCount: this.state.currentCount+1
    })
  }
  
  // Basic parent decrement handler
  decrement() {
    this.setState({
      currentCount: this.state.currentCount-1
    })
  }
  
  render() {
    return(
      <div>
        <h2>Current Count: {this.state.currentCount}</h2>
        <Increment increment={this.increment.bind(this)} />
        <Decrement decrement={this.decrement.bind(this)} />
      </div>
    );
  }
}

// Here Increment and Decrement are being represented as stateless functional components. Note that props is passed as an argument & 'this' is not required. Also we don't need to implement render(), just return some valid JSX.
const Increment = (props) => {
      return <button onClick={props.increment}>Higher</button>
}

const Decrement = (props) => {
      return <button onClick={props.decrement}>Lower</button>
}

ReactDOM.render(<Counter />, document.getElementById('app'));
            
          
!
999px
Loading ..................

Console