Live data from Hacker News

Why I'm Not a React Native Developer

arielelkin.github.io

21–30 of 318 posts

Re: Why I'm Not a React Native Developer

#21
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 ;
      }
    }

    function ConnectivityIndicatorView(props: {isConnected: boolean}) {
      const color = props.isConnected ? 'green' : 'red';
      return ;
    }
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.

Re: Why I'm Not a React Native Developer

#22
Ughhh. It's fine if you prefer statically-typed languages to dynamically-typed ones, but that's a preference, not a reason to try and say that JS is objectively terrible.

Same with switch fallthrough, same with error handling, same with half his issues with JS.

There are some legitimate grievances tucked in there, but the author lost me by pretending that his preferences were universal.

Re: Why I'm Not a React Native Developer

#24
post #14
post #5

You could have just said "I don't like Javascript" and ended the post there.

I feel like this is some sort of signaling, a la 'no true programmer uses javascript, because types!'.

I used to half joke like this, but recently I've been doing some React work in ES6 with Flowtype annotations. It's actually not that bad.

Re: Why I'm Not a React Native Developer

#25

Ughhh. It's fine if you prefer statically-typed languages to dynamically-typed ones, but that's a preference, not a reason to try and say that JS is objectively terrible. Same with switch fallthrough, same with error handling, same with half his issues with JS. There are some legitimate grievances tucked in there, but the author lost me by pretending that his preferences were universal.

I prefer statically-typed languages too, but this is easily solved by using something TypeScript or Flow.

Re: Why I'm Not a React Native Developer

#26
post #15

Is anyone using TypeScript with React Native? I'd be interested to see how easy that is to integrate.

In that case it would probably make more sense to just use NativeScript instead of React Native. https://www.nativescript.org/

NativeScript looks really promising. My colleagues have used it for numerous client apps. It's not as mature as Appcelerator Titanium so it doesn't have as many plugins for advanced things like video recording or audio playback but if it continues to get traction, it could become a really good option.

Re: Why I'm Not a React Native Developer

#27

Is anyone using TypeScript with React Native? I'd be interested to see how easy that is to integrate.

Yes. It is not difficult. There are typings files floating around. When you need to use something that's not in the typings file, spend 2 minutes updating it and keep going. Not a big deal at all.

Re: Why I'm Not a React Native Developer

#28
post #21

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 { rende…

The point of having isConnected in the state is that it will change depending on OS events. Random is just used as an example

Re: Why I'm Not a React Native Developer

#29
post #28
post #21

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 { rende…

The point of having isConnected in the state is that it will change depending on OS events. Random is just used as an example

Even with state, his code is overly verbose and can be expressed in a much more idiomatic way.

    var weAreConnected = Math.floor(Math.random() * 10) > 5;
    if (weAreConnected === true) {
      this.setState({
        isConnected: true
      })
    } 
    else {
      this.setState({
        isConnected: false
      })
    }
  }
turns into

    var weAreConnected = Math.floor(Math.random() * 10) > 5;
    this.setState({
      isConnected: weAreConnected
    });
It's almost like he wrote it in the most obtuse way possible to prove his point. Unless he writes like that normally; If so then I can see where he's getting all these errors from.
Post reply on HN