I am having trouble passing a variable from a .jade file to a react component. Here is a section of my jade file:
block content
#example
var user = '#{user}';
span #{user.id}
span #{user.displayName}
And here is app.jsx, the react component that I would like to have access to the variable user.
var React = require('react');
var HelloWorld = require('./HelloWorld.jsx');
var $ = jQuery = require('../../libraries/jquery/dist/jquery');
var bootstrap = require('../../libraries/bootstrap-sass-official/assets/javascripts/bootstrap');
React.render(
<HelloWorld/>,
document.getElementById('example')
);
I've tried logging this.props.user and window.user to the console from app.jsx but it is undefined. Ideally, I would like this.props.user in app.jsx to be the user that the jade file has access to. Then I would be able to pass that user variable into the HelloWorld component, for example. Perhaps there's a better way of doing this and I, being new to jade and react, would certainly appreciate that advice.