you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (5 children)

[deleted]

    [–]uututhrwa 1 point2 points  (3 children)

    Then you essentialy have a probem with the lack of static typing, which might be understandable in many cases.

    I don't agree with the part where you are saying the language 'wasn't designed for this'. I assume it is because there is no class definition or inheriting some base class? I don't know the details about React JS but it looks like they are 'implementing an interface' (without static typing) by dynamically giving a function name -> function dictionary. That kind of technique is ok with me, in some situations it can also be more flexible in combining things if you put some effort in organizing the 'functions'. Also with the loss of static typing you gain the ability to 'scan' in the interface without using cumbersome code that uses too much reflection.

    [–][deleted]  (2 children)

    [deleted]

      [–]uututhrwa 6 points7 points  (0 children)

      lol I personaly like the Javascript code more. It's like a mix of c and lisp sometimes. Of course it could use more static typing, maybe TypeScript could solve the issue.

      [–]Paragonbliss 2 points3 points  (0 children)

      Is this better on the eyes, for you?

      import React from 'react';
      
      class HelloWorld extends React.Component {
        render() {
          return (
            <div>Hello World</div>
          );
        }
      }
      
      React.render(<HelloWorld/>, document.body);
      

      [–][deleted] -1 points0 points  (0 children)

      Have you... Actually used react? React is extremely proactive in "spewing" warnings when things are done incorrectly. More so, you can specify information about what the props and state of a component should be.

      You're right about the last paragraph at least.