Skip to content
This repository has been archived by the owner on Nov 11, 2017. It is now read-only.

Commit

Permalink
Support for modules which export React elements
Browse files Browse the repository at this point in the history
This adds support for modules which export React elements:

    export default (
      <div>
        Hello, world!
      </div>
    )

Which is nice as it saves us from boilerplate we don't need.

Hot reloading feature is preserved.
  • Loading branch information
andreypopp committed Jul 15, 2015
1 parent 2231f52 commit d4d730a
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions dummy.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
var React = require('react')
var React = require('react')
var Component = require('theydoitonpurposelynn')
React.render(<Component/>, document.querySelector('#app'))

function render(Component) {
if (!(Component.type && Component.props)) {
Component = <Component />;
}
React.render(Component, document.querySelector('#app'))
}

render(Component);

if(module.hot) {
module.hot.accept("theydoitonpurposelynn", function() {
render(require("theydoitonpurposelynn"));
});
}

0 comments on commit d4d730a

Please sign in to comment.