Created by: jayphelps
Now if they use JSX, it will transparently import react
and correctly reference the right createElement()
. No more awkward import React from 'react';
.
Before
import React from 'react';
const App = () => (
<div>hello world</div>
);
export default App;
var _react = __webpack_require__(35);
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var App = function App() {
return (0, _react.createElement)(
'div',
null,
'hello world'
);
};
exports.default = App;
After
const App = () => (
<div>hello world</div>
);
export default App;
var _react = __webpack_require__(35);
var App = function App() {
return (0, _react.createElement)(
"div",
null,
"hello world"
);
};
exports.default = App;
Anyone I show this ability to so instantly says "omg why didn't I use this earlier", so I imagine it is a welcome addition; but perhaps some will say it's "too much magic"...but let's be real, JSX is magic.
I could not find a test suite for create-react-app; I assume there isn't currently a test suite for the cli/scripts?