I am currently trying to migrate AngularJS Code in ASPX to React. I would like to pass some variables of aspx to .jsx files which it can be used by react component.
Mainpage.aspx contains some variables which needs to be passed to Client.jsx(which is in React).
I am trying to access this variable noSessionText from .aspx file to .jsx and i am failing to achieve it.
aspx code
<asp:Content ID="BodyContent" ContentPlaceHolderID="ContentPlaceHolderMiddlePanel" runat="Server">
var noSessionText = '<%= Resources.WebPageResource.SessionSharing_NoSessions_Text %>';
var HeaderName = '<%= Resources.WebPageResource.SessionSharing_Header_Name %>';
<!--test code-->
<script src="https://unpkg.com/react@15/dist/react.js"></script>
<script src="https://unpkg.com/react-dom@15/dist/react-dom.js"></script>
<script src="https://unpkg.com/[email protected]/babel.min.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script type="text/babel" src="includes/scripts/Client.jsx"></script>
<div id="SessionClient_root" ></div>
</div>
</div>
</asp:Content>
jsx code
class Client extends React.Component {
constructor(props) {
super(props);
this.state = {
activeSessions: {},
headerUserSession: props.HeaderName
};
}
renderSessionDetails() {
console.log("inside rendersessiondetails");
console.log("headerusersession from aspx->react" + this.state.HeaderName);
}
render() {
return (
<div>
<h3 className="sessionmanager__headline">SESSIONCLIENT IN REACT</h3>
{this.renderSessionDetails()}
</div>
);
}
}
ReactDOM.render(
<Client />,
document.getElementById('SessionClient_root')
);
Is there any way which i could achieve this. Thanks in advance for help.