I have a front-end that is built using React states that is meant to adapt based on user action. However, my front-end React is also meant to show and allow manipulation of my server-side data. Currently my view engine is EJS, and I am using it to display data. As a broad example:
return (<div class="col-md-6 col-sm-6 col-xs-7">
<ul>
<li><span class="point">Name:</span> <%= user.profile.name %> </li>
<li><span class="point">Email:</span> <%= user.email %> </li>
</ul>
</div>);
<%=
In express:
res.render('view', {user: myUser});
In EJS before the app's js bundle:
<script type='text/javascript'>
var userFromServer =<%-JSON.stringify(user)%>
</script>
Use userFromServer
in your react code.