How to integrate react js into game web app
I have zero knowledge of the loading platform, but it is not difficult to integrate react in a web application.
if you compiled the js react jsj file. just include in the heading tag on your index page. and declare div with id. and then do some code like this
Html
<div id="root">
<!-- This element contents will be replaced with your component. -->
</div>
reactjs
ReactDOM.render(
<h1>Hello, world!</h1>,
document.getElementById('root')
);
demo: http://codepen.io/gaearon/pen/rrpgNB?editors=1010
and this blog article might be helpful for solving your problem https://facebook.github.io/react/docs/rendering-elements.html
source to share
I think the best way to manage dependencies in a Play app is through WebJars. First, add the WebJars dependency tobuild.sbt
libraryDependencies ++= Seq(
"org.webjars" %% "webjars-play" % "2.5.0",
"org.webjars" % "bootstrap" % "3.1.1-2"
)
Now you have to declare the asset routes in the file routes
GET / assets / * file controllers .Assets.at (path = "/ public", file) GET / webjars / * file controllers .WebJarAssets.at (file)
Then you can add a reaction to the HTML file:
<head>
<script type='text/javascript' src='@routes.WebJarAssets.at(WebJarAssets.fullPath("react", "react.js"))'></script>
</head>
source to share