Skip to content

Instantly share code, notes, and snippets.

@CADBOT
Last active August 29, 2015 14:22
Show Gist options
  • Save CADBOT/8af7e374dc9725316814 to your computer and use it in GitHub Desktop.
Save CADBOT/8af7e374dc9725316814 to your computer and use it in GitHub Desktop.
// this is the last alert that works
alert('here in component app')
var MyApp = React.createClass({
render: function() {
return (<p>hello</p>)
}
})
// this alert is never reached
alert('about to export')
module.exports = myApp
var React = require('react')
alert('here in index before require')
var MyApp = require('./components/myApp')
alert('returned from require')
React.render(
<MyApp />
, document.getElementById('app'))
{
"name": "react-test",
"version": "1.0.0",
"description": "",
"main": "js/app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "browserify app/js/app.js -o public/js/bundle.js"
},
"license": "ISC",
"dependencies": {
"jquery": "^2.1.4",
"react": "^0.13.3"
},
"devDependencies": {
"babel": "^5.4.7",
"babel-core": "^5.4.7",
"babel-loader": "^5.1.3",
"browserify": "^10.2.3",
"node-libs-browser": "^0.5.2",
"reactify": "^1.1.1",
"webpack": "^1.9.10"
},
"browserify": {
"transform": [
"reactify"
]
}
}
<html>
<head>
<title>React test</title>
</head>
<body>
<section id='app'></section>
<script src='public/js/bundle.js'></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment