node.js - React Components on the Server -


i've been playing around react while still can't wrap head around on how integrate existing node/express/handlebars app.

for example, if had feed component required json data fetched aws - how handle this.

var videofeed = require('./component/videofeed');  app.use('/', function(res, req) {      dataservice.getvideofeed().then(function(data) {         res.render('home', {videocomponent: react.rendertostring(<videofeed feed={data} />);     }); }); 

home

<!doctype html> <body>     sample text.  here's video feed     {{videocomponent}} </body> </html> 


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -