Skip to content

Instantly share code, notes, and snippets.

@STRML

STRML/.babelrc Secret

Created February 7, 2016 19:25
Show Gist options
  • Save STRML/2368912862f39ce8e832 to your computer and use it in GitHub Desktop.
Save STRML/2368912862f39ce8e832 to your computer and use it in GitHub Desktop.
{
"presets": [
"es2015"
],
"plugins": [
"transform-runtime"
],
}
var React = require('react');
var ReactDOMServer = require('react-dom/server');
var iterable = new Map();
iterable.set('a', React.createElement('div', null, 1));
iterable.set('b', React.createElement('div', null, 2));
console.log(ReactDOMServer.renderToStaticMarkup(React.createElement('div', null, iterable)));
'use strict';
var _map = require('babel-runtime/core-js/map');
var _map2 = _interopRequireDefault(_map);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var React = require('react');
var ReactDOMServer = require('react-dom/server');
var iterable = new _map2.default();
iterable.set('a', React.createElement('div', null, 1));
iterable.set('b', React.createElement('div', null, 2));
console.log(ReactDOMServer.renderToStaticMarkup(React.createElement('div', null, iterable)));
/project/node_modules/fbjs/lib/invariant.js:46
throw error;
^
Invariant Violation: Objects are not valid as a React child (found: object with keys {_i, _f, _l, _s}). If you meant to render a collection of children, use an array instead or wrap the object using createFragment(object) from the React add-ons.
Warning: Using Maps as children is not yet fully supported. It is an experimental feature that might be removed. Convert it to a sequence / iterable of keyed ReactElements instead.
<div><div>1</div><div>2</div></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment