Comment

Comment by STRML

This is simply a list of things the author doesn't like about JS, very much of which is practically solved by Flow/TS and ESLint.

He also makes some of the React examples quite a bit more complicated than they need to be. Declarative UI is very simple!

Here's the same code, using both class and functional styles (whichever you prefer), in a much more succinct style (11 LOC vs 49):

    class Root extends Component {  
      render() {
        var isConnected = Math.floor(Math.random() * 10) > 5;
        return <ConnectivityIndicatorView isConnected={isConnected} />;
      }
    }

    function ConnectivityIndicatorView(props: {isConnected: boolean}) {
      const color = props.isConnected ? 'green' : 'red';
      return <View style={{backgroundColor: color, width: 20, height: 20}} />;
    }
The point is, much like many things in software, it's all about perceptions and familiarity. He's not familiar with JS, and I don't fault him for that - it's a quirky language. But for the many, many developers who have built up a tolerance to JS and built/use tools to tame it, moving to React Native is a breath of fresh air vs learning Android & iOS toolchains and idiosyncrasies.
parent STRML 10 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton