Created
November 16, 2016 21:22
-
-
Save formula1/92ca8e613fcadafdfdd27bedd119f972 to your computer and use it in GitHub Desktop.
Inferno Basic Example
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
Show hidden characters
{ | |
"presets" : [ "es2015" ], | |
"plugins" : [ "inferno" ] | |
} |
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
import Inferno from 'inferno'; | |
import Component from 'inferno-component'; | |
export class Index extends Component { | |
render(){ | |
return (<div>Content is here hello Content =)</div>); | |
} | |
} |
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": "inferno-problem", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1", | |
"start": "node server.js" | |
}, | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"inferno": "^0.7.27", | |
"inferno-component": "^0.7.27", | |
"inferno-server": "^0.7.27" | |
}, | |
"devDependencies": { | |
"babel-cli": "^6.18.0", | |
"babel-plugin-inferno": "^1.0.0-legacy", | |
"babel-plugin-syntax-jsx": "^6.18.0", | |
"babel-preset-es2015": "^6.18.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
import InfernoServer from 'inferno-server'; | |
import Inferno from 'inferno'; | |
import Index from './index'; | |
let stream = InfernoServer.streamAsString( | |
<Index /> | |
); | |
stream.on('data', (chunk)=>{ | |
console.log('got data'); | |
}); | |
stream.on('error', (err)=>{ | |
console.error(err); | |
}); | |
stream.on('end', ()=>{ | |
console.log('end'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment