1

I want to write this code:

<script type="text/jsx">
    var MessageBox = React.createClass({

        render: function() {
            return <div>Hello World</div>
        }
    });
</script>

When I typing </ in line return <div>Hello World</ Sublime auto-closes tag to </script> instead of </div>.

This is very annoying while coding using JSX style (react.js)

Is there any way to fix this?

pupadupa
  • 1,530
  • 2
  • 17
  • 29
  • I think you can turn off the predictions but while looking at your source code your return should be wrapped in single or double quotes. `return '
    Hello World
    ';` only time you don't need to wrap the return is if it's true/false or a variable you want to return.
    – NewToJS Mar 05 '15 at 22:31
  • 1
    @NewToJS i don't think that's plain old javascript. It's text/jsx, which gets transformed to plain javascript i think. – Kevin B Mar 05 '15 at 22:33
  • @KevinB so when the function gets to the return it wouldn't display `Uncaught SyntaxError: Unexpected token <` in the console? – NewToJS Mar 05 '15 at 22:35
  • 1
    Not entirely sure, i've never used the jsx transformer. The getting started demo shows something similar: http://facebook.github.io/react/docs/getting-started.html – Kevin B Mar 05 '15 at 22:35
  • So it does, my apologies! (*Makes note of that one*) Well, we all make mistakes but thank you for the heads up on that one @KevinB – NewToJS Mar 05 '15 at 22:38
  • 1
    @pupadupa have you tried this sublime extension? https://github.com/reactjs/sublime-react – Kevin B Mar 05 '15 at 22:38
  • @KevinB Thank you! This extension solves the problem! – pupadupa Mar 05 '15 at 22:47

0 Answers0