This:
var child = React.createElement('li', null, 'Text Content');
var root = React.createElement('ul', { className: 'my-list' }, child);
Is the same as this:
var root = <ul className="my-list">
<li>Text Content</li>
</ul>;
- Syntax +
constructor
propTypes
,getDefaultProps
andgetInitialState
this
binding- mixins
Recommendation: Facebook does suggest the future removal of React.createClass completely in favour of ES6 classes.
We found extends React.Component
to be more easily tested.
Running:
$ webpack
While inside the folder, will compile the code and create the index.js
in the same folder. Then you can take a look at it.
webpack-dev-server
: The dev server uses webpack’s watch mode. It also prevents webpack from emitting the resulting files to disk. Instead it keeps and serves the resulting files from memory.