How to use ReactJS on Rails without react-rails -
i want try react on rails.
but dont know how use correctly.
i put require @ head of application.coffee, , copy code form facebook's
#= require react/react #= require react/jsxtransformer #= require react/react-with-addons.min $ -> hello = react.createclass render: -> `<h1>h</h1>` view = document.queryselector('#content') react.render(`<hello/>`, view) why use ` in template because react-rails use jsx.
but finally, got error :
uncaught syntaxerror: unexpected token < so, can me? thank you.
the jsxtransformer script transforms jsx inside <script> tags type=text/jsx. making work within rails asset pipeline bit more involved.
react-rails registering new tilt engine .jsx files on startup calls jsx::transform, in turn manually invokes jsx transformer part of asset pipeline.
Comments
Post a Comment