Created
February 19, 2015 18:52
-
-
Save artisonian/b41341f5c64c0821f4b7 to your computer and use it in GitHub Desktop.
node-jsx example
This file contains hidden or 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
| node_modules |
This file contains hidden or 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
| /* jshint node:true */ | |
| 'use strict'; | |
| require('node-jsx').install({ | |
| extension: '.jsx', | |
| harmony: true | |
| }); | |
| var Test = require('./test'); | |
| var test = new Test(); // This was missing from the original | |
| test.testOutput(); | |
| require('./es6-component'); |
This file contains hidden or 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 React = require('react'); | |
| // `React.createClass` takes in an object...it isn't a class constructor. | |
| // In React v0.13, you can do this instead: | |
| // | |
| // class ES6Component extends React.Component { | |
| // render() { | |
| // return <div>Hello</div> | |
| // } | |
| // } | |
| // | |
| var ES6Component = React.createClass({ | |
| render: () => <div>Hello</div> // Note this is an object property | |
| }); |
This file contains hidden or 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": "node-jsx-example", | |
| "version": "1.0.0", | |
| "description": "Addresses comment in https://github.com/petehunt/node-jsx/issues/26", | |
| "private": true, | |
| "dependencies": { | |
| "node-jsx": "^0.12.4", | |
| "react": "^0.13.0-beta.2" | |
| }, | |
| "scripts": { | |
| "start": "node app.js" | |
| } | |
| } |
This file contains hidden or 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
| class TestClass { | |
| testOutput() { | |
| console.log('Some text...') | |
| } | |
| } | |
| module.exports = TestClass; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment