I recently used React in my recent project. I am definitely a newbie. I read articles from internet. A lot of people seems excited about React. I just don't know why...
Here are some things I don't like React.
- It needs compile the jsx to js. The code you wrote is not the code running in browser.
- The code is not neat. If you compare the compiled js with the jsx. They are similar but the compiled js is more verbose. So I guess using jsx is to make code short and easy to read. But is the jsx really neat? To create a simple div, I need write
- The code generated by runtime compiler does not equal to the compiled js. One example is that when using runitme compiler, in an external js file, I cannot get the reference of any React component. And the React components created in one jsx cannot refer to another React component created in another jsx.
var ComponentA = React.createClass({render: function(){ return <div>abcdefg...</div>;}});
http://sterling.ghost.io/working-with-jqueryui-and-reactjs-components/
http://blog.arkency.com/2014/10/you-can-move-react-root-component-around/
https://groups.google.com/forum/#!msg/reactjs/mHfBGI3Qwz4/6s-eHGEpccwJ
https://jsfiddle.net/hairinwind/6t7Lcz8s/1/
If you comment js line 5 and uncomment line 4, you will see the error."Cannot read property 'name' of undefined"
As I said, I was a newbie. For some problems listed above, like #2, there might be a way to solve it. I did google it on internet but I did not find an easy way.
Here is the cheatsheet for react.js http://ricostacruz.com/cheatsheets/react.html
No comments:
Post a Comment