Error Components Is Not Defined Source File
Contents |
Sign in Pricing Blog Support Search GitHub This repository Watch 107 Star 3,497 Fork 382 reactjs/react-rails Code Issues 82 Pull requests 9 Projects 0 Wiki Pulse react referenceerror component is not defined Graphs New issue React.js outputs to the js console: ReferenceError:
React Referenceerror: $ Is Not Defined
to work. Note that I'm trying to use a pure coffeescript solution, with no interpolated jsx. In my coffeescript file (its extension is *.js.coffee ) {div} = React.DOM Hello = React.createClass render: -> (div {}, ['Hello ' + @props.name]) In my view: = react_component 'Hello', name: 'World' And this is the error I consistently get in my console: ReferenceError: Hello is not defined component is not defined reactjs What am I missing guys? jakubmal commented Mar 1, 2014 Hi, Have you used CS before? It creates a closure, which will likely look like: (function() { var div, hello; div = React.DOM.div; Hello = React.createClass({ render: function() { return div({}, ['Hello ' + this.props.name]); } }); }).call(this); making hello inaccessible outside the closure. What you could do is to assign Hello to window like: window.Hello = React.createClass or using a shortcut/trick: @Hello = React.createClass To keep your app structure clean, you will need to apply at least a namespace pattern here. http://addyosmani.com/blog/essential-js-namespacing/ KurtRMueller commented Mar 2, 2014 Awesome. Thanks for your help. I have used coffeescript before but I still require heavy use of translators like js2coffee. I really need to sit down and take some time to learn how coffeescript compiles to js. Thanks again for the help. jakubmal commented Mar 2, 2014 If you have any more questions, I'm happy to help, otherwise if we're done here, would you mind closing the issue? KurtRMueller commented Mar 2, 2014 Not, not at all, but before I do, here's a comment from Paul O'Shan
Sign in Pricing Blog component is not defined angular 2 Support Search GitHub This repository Watch 7
React Is Not Defined
Star 77 Fork 39 mariopeixoto/react-router-rails Code Issues 5 Pull requests 2 Projects
React.createclass Is Not A Function
0 Pulse Graphs New issue Uncaught ReferenceError:
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this http://stackoverflow.com/questions/29342661/component-undefined-in-reactjs site About Us Learn more about Stack Overflow the company Business Learn more http://stackoverflow.com/questions/22130629/react-js-outputs-to-the-jsc-referenceerror-component-is-not-defined about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Component undefined is not in ReactJS up vote 0 down vote favorite 1 I'm playing around with ReactJS. I have defined three components, which are nested: UserProfile.jsx var React = require('react'); var UserProfile = React.createClass({ getInitialState: function() { return { username: "zuck" }; }, render: function() { return (
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up React.js outputs to the jsc: ReferenceError: