node.js - Send prop to ReactJs from Express response (render) -


i have simple application , , , .

i have index.html includes client.js simple render of :

var react = require('react'); var react = require('react-dom'); var client = require('./client.jsx'); reactdom.render(     react.createelement(client, null),     document.getelementbyid('main') ); 

client real application.

on server side (routes.js) have this: app.get('/login', function(req, res){ res.render('login'); });

app.get('/auth/google', passport.authenticate('google', { scope: ['profile', 'email'] }),function(req, res){}); app.get('/auth/google/callback',passport.authenticate('google', { failureredirect: '/login' }), function(req, res) {     res.redirect('/'); });  app.get('/', ensureauthenticated ,function(req, res){     req.session.id = req.user._id; //from mongodb     res.render('index', { user: req.user }); });  function ensureauthenticated(req, res, next) {     if (req.isauthenticated()) { return next(); }     res.redirect('/login') } 

i want send information loged user (username, real name, avatar, , others) top hierarchy component.

  • the way go use cookies?
  • using use cookies right?
  • can update flux () store express on response?
  • is there way send props top reactjs component (client)? don't handle cookies if there no other way use cookies.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -