codepen-post-to-prefill-editors

You can start a new Pen with code and settings that you send across programatically. author(s): Marco Montalbano

HTML

<form action="https://codepen.io/pen/define" method="POST">
  <textarea id="data" name="data" rows="10" cols="50"></textarea>
  <p>
    Not automatically redirecting?
    <br><br><input type="submit" value="Click here">
  </p>
</form>

JavaScript

var codepenData = {
  editors:"0010",
  html:"<div id=\"root\"></div>",
  js:"ReactDOM.render(\n <h1>Hello, world!</h1>,\n document.getElementById('root')\n);\n",
  js_external:"//unpkg.com/react/umd/react.development.js;//unpkg.com/react-dom/umd/react-dom.development.js",
  js_pre_processor:"babel",
  layout:"left"
};

document.getElementById('data').value = JSON.stringify(codepenData);