1

I just started learn ReactJS and from the very start I have problem! As I can see you say that React working with coffee. my file hello.js.jsx.coffee

HelloWorld = React.createClass render: -> `<div> <h1>Hello World!</h1> </div>` 

and in my view:

= react_component('HelloWorld', {}, :span) 

But I get error:

ReferenceError: HelloWorld is not defined

sample of my app is:

https://github.com/olegsobchuk/example_app

I'm using Rails 4.2.

    1 Answer 1

    1

    So, I found resolve

    instead

    HelloWorld = React.createClass ..... 

    we have to use

    @HelloWorld = React.createClass render: -> `<div> <h1>Hello World!</h1> </div>` 

    Thanks @rmosolgo !

      Start asking to get answers

      Find the answer to your question by asking.

      Ask question

      Explore related questions

      See similar questions with these tags.