|
|
|
|
|
by alexggordon
3980 days ago
|
|
I've been curious about React for awhile now, but every time I step in to play around with it, I get really turned off by the syntax. This is a react render function mentioned in the tutorial (gist with all code here[0]): render() {
let delta = this.props.delta ? (
<strong className={this.props.delta > 0 ? 'text-success' : 'text-danger'}>
{this.props.delta}
</strong>
) : null;
return (
<div className='card'>
{delta}
{this.props.title}
</div>
);
}
This is approximately that same function written in ERB and Rails syntax. <div class='card'>
<%= content_tag_for(:strong, :class => @delta > 0 ? 'text-success' : 'text-danger' ) do %>
<%= @this_props_title %>
<% end %>
</div>
On just a pure typing basis, the ERB would take half as long to type as the react version. Even writing that same function in backbone templates (which I use frequently) would take less text, and be easier to read. Maybe I haven't given react and other js frameworks enough of a chance, but to a person that hasn't learned them, that render function above is a huge deterrent.[0] https://gist.github.com/alexggordon/820020aab934bf192b81 |
|
One could just as easily argue:
Is the same amount of typing. Honestly though, I feel as though this whole argument is a bit of an apples-to-oranges type of argument.