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
Post a Comment