Skip to content

Instantly share code, notes, and snippets.

@formula1
Created November 16, 2016 21:22
Show Gist options
  • Save formula1/92ca8e613fcadafdfdd27bedd119f972 to your computer and use it in GitHub Desktop.
Save formula1/92ca8e613fcadafdfdd27bedd119f972 to your computer and use it in GitHub Desktop.
Inferno Basic Example
{
"presets" : [ "es2015" ],
"plugins" : [ "inferno" ]
}
import Inferno from 'inferno';
import Component from 'inferno-component';
export class Index extends Component {
render(){
return (<div>Content is here hello Content =)</div>);
}
}
{
"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"
}
}
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