"JQuery Mobile Components in React"
I'm quite new to this concept an still need to figure things out. I built an app for mobile purposes and decided to wrap it in React components. My Code:
index.html
<!DOCTYPE html>
<html lang="de" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>shounds</title>
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.squareui.css" />
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<script src="./ext/react.js"></script>
<script src="./ext/jsx-transform.js"></script>
<script src="//fb.me/react-with-addons-0.11.0.js"></script>
</head>
<body data-theme="e">
<div id="container" >
<!--<div data-role="page" id="login"><div data-role="header" id="loginHeader"></div></div>-->
</div>
<script type="text/jsx" src="./comp/main.js"></script>
</body>
</html>
main.js //react components
var App = React.createClass({
render: function () {
return Page({id: 'login'});
}
})
var Page = React.createClass({
constants: { dataTheme: 'e' },
render: function () {
return React.DOM.div({ id: this.props.id + 'Page', 'data-role': 'page', 'data-theme': this.constants.dataTheme },
Header({ dataTheme: this.constants.dataTheme, id: this.props.id }))
}
})
var Header = React.createClass({
render: function(){
return React.DOM.div({'data-role': 'header', 'data-theme': this.props.dataTheme, id: this.props.id+'Header' })
}
})
// Render application.
React.render(App(null), document.getElementById('container'))
The DOM gets created in the container div as expected.
Heres my Problem:
JQM probably isnt aware of the virtual DOM getting created by React and creates an initial page by itsself outside the container div. Even though the DOM is created correctly it wont be displayed as JQM page with Header.
Anyone gone through the same stuff?
Thanks in advance.
EDIT: if it helps in any way -> this is what is created during runtime
<head></head>
<body class="ui-mobile-viewport ui-overlay-a" data-theme="e">
<div class="ui-page ui-page-theme-a ui-page-active" data-role="page" data-url="/E:/dev/workspace/visual/shounds/index.html" tabindex="0" style="min-height: 483px;">
<div id="container">
<div id="loginPage" data-reactid=".0" data-theme="e" data-role="page">
<div id="loginHeader" data-reactid=".0.0" data-theme="e" data-role="header"></div>
</div>
</div>
<script src="./comp/main.js" type="text/jsx"></script>
</div>
<div class="ui-loader ui-corner-all ui-body-a ui-loader-default"></div>
</body>
</html>