Reactjs and requirejs

While working on the QlockTwo project I was struggling with combining react.js and require.js.

Finally I get it done:

  1. Download require.js from and http://requirejs.org/docs/download.html and jsx.js from https://github.com/podio/requirejs-react-jsx and put both e.g. in the javascript folder in your project.
  2. Index.html contains in the header the link to the require.js file:

     
  3. My app.js (main entry point from the index.html) looks like that

  4.  
  5. Qlock.js contains the jsx components that get rendered now. Please be aware that if you decide to use require.js you should load all your Javascript libraries with it to avoid errors.

 

GD Star Rating
loading...

Kommentar verfassen