Created
July 24, 2014 14:56
-
-
Save zregvart/0716d02059cb13778823 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @jsx React.DOM */ | |
'use strict'; | |
var React = require('react'); | |
var DesktopApp = require('./desktopApp'); | |
React.renderComponent(<DesktopApp />, document.body); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @jsx React.DOM */ | |
'use strict'; | |
var React = require('react'); | |
var DesktopApp = React.createClass({ | |
getInitialState: function() { | |
return { counter: 0 }; | |
}, | |
componentDidMount: function() { | |
var self = this; | |
window.setInterval(function() { | |
self.setState({ counter: self.state.counter + 1 }); | |
}, 1000); | |
}, | |
render: function() { | |
return ( | |
<div> | |
<h1>Hello desktop world!!</h1> | |
<p>val: {this.state.counter}</p> | |
</div> | |
); | |
} | |
}); | |
module.exports = DesktopApp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @jsx React.DOM */ | |
'use strict'; | |
var React = require('react'); | |
var MobileApp = React.createClass({ | |
getInitialState: function() { | |
return { counter: 0 }; | |
}, | |
componentDidMount: function() { | |
var self = this; | |
window.setInterval(function() { | |
self.setState({ counter: self.state.counter + 1 }); | |
}, 1000); | |
}, | |
render: function() { | |
return ( | |
<div> | |
<h1>Hello mobile world</h1> | |
<p>val: {this.state.counter}</p> | |
</div> | |
); | |
} | |
}); | |
React.renderComponent(<MobileApp />, document.body); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "example_app", | |
"version": "0.0.1", | |
"devDependencies": { | |
"react-hot-loader": "0.2.0", | |
"jsx-loader": "0.11.0", | |
"webpack": "1.3.2-beta5", | |
"webpack-dev-server": "1.4.7" | |
}, | |
"dependencies": { | |
"react": "0.11.0" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var webpack = require('webpack'); | |
var path = require('path'); | |
module.exports = { | |
entry: { | |
desktop: ['webpack/hot/dev-server', './desktop'], | |
mobile: ['webpack/hot/dev-server', './mobile'] | |
}, | |
output: { | |
path: path.join(__dirname, 'build'), | |
publicPath: '/build/', | |
filename: '[name].js', | |
}, | |
resolveLoader: { | |
modulesDirectories: ['node_modules'] | |
}, | |
resolve: { | |
extensions: ['', '.jsx', '.js'] | |
}, | |
module: { | |
loaders: [ | |
{ test: /\.jsx$/, loaders: ['react-hot', 'jsx'] } | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment