Pen Settings



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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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.


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.


                <div id="root"></div>


  border: 1px solid gray
  background-color: lightgray
  border-radius: 3px
  padding: 3px
  margin: 3px
  font-weight: bold



                class RecipeBox extends React.Component {
  constructor(props) {
    // some dummy recipes to start out
    const initRecipes = [
      { name: "pie", ingredients: "flour, apples" },
      { name: "meatballs", ingredients: "meat, flour, eggs" },
      { name: "shepheard's pie", ingredients: "meath, gravy, mashed potatoes" },
      { name: "ceviche", ingredients: "fish, onion, lemon juice" },
      { name: "suffing", ingredients: "bread cubes, chicken stock, celery, onions" },
      { name: "pizza", ingredients: "crust, sauce, cheese, pepperoni" }
    // put them in state
    this.state = {
      recipes: initRecipes
    // bind *this* to our class method
    this.handleRemove = this.handleRemove.bind(this);
  handleRemove() {
    // create a new copy of the recipes so we can change it
    let newRecipes =
    // remove a random recipe
    newRecipes.splice(Math.floor(Math.random()*, 1)
    // put it into state
    this.setState({ recipes: newRecipes })

  render() {
    // just a simple way of changing out array of data into an array of JSX
    // I could have put it directly in the JSX, but this is cleaner
    const renderRecipes = => (
      <div className="recipe">
        <span className="recipe-name">{}:</span> &nbsp;
        <span className="recipe-ingredients">{recipe.ingredients}</span>    
    return (
        <br />
        <button onClick={this.handleRemove} disabled={}>
          Remove random recipe!
ReactDOM.render(<RecipeBox />, document.getElementById("root"))