Live data from Hacker News

Learn React by building a web app

udilia.com

101–107 of 107 posts

Re: Learn React by building a web app

#101

Not a single lesson titled: "How to write tests" With snapshots, while not perfect, they do catch a lot and are easy to do (and more importantly, easy to update when things change). React components are relatively easy to further test with enzyme and jest. Without a focus on instructing people how to do testing, people never bother.

I’ve been through a few “intro to react” courses like this now, and I have not come across a single one that talks about testing at any length, which seems insane to me. When I was learning Rails many years ago, test-driven development was all the rage. React, with it’s declarative approach, stateless components, immutable state, etc. seems purpose-built for testability. TDD with React should be ridiculously easy, bu…

The culture doesn't exist in JavaScript land because historically it has been difficult to do. The tooling sucked. It is getting vastly better, but sadly, it will take effort to get back into the practice.

I hope that more people building the learning courses will focus on that. If I had time, I'd do one myself, as I now heavily test all my React stuff. I refuse to build another webapp without proper automated unit testing. It catches so much stuff.

Re: Learn React by building a web app

#102
post #98

Earlier quoted context omitted.

I’ve been through a few “intro to react” courses like this now, and I have not come across a single one that talks about testing at any length, which seems insane to me. When I was learning Rails many years ago, test-driven development was all the rage. React, with it’s declarative approach, stateless components, immutable state, etc. seems purpose-built for testability. TDD with React should be ridiculously easy, bu…

Here's one: https://medium.com/@mbaranovski/quick-guide-to-tdd-in-react-...

No offense, but I feel like this is not a good example to follow.

The first examples are better off with just using snapshots. Even if the author is trying to explain the concepts, it is really poor to show bad examples that could be covered by a simpler solution. If I read that and didn't know about snapshots, I'd think to myself, "why am I testing strings?" and then skip testing entirely.

Mocking Axios also seems like the wrong way to approach things. I'd extract the networking code from the presentation code. Possibly by using mobx-state-tree (which is an epic solution to a hard problem). This way, I wouldn't even need to mock Axios at all and I could then just take advantage of snapshots again by providing actual mock data to my components directly.

Re: Learn React by building a web app

#103

Earlier quoted context omitted.

I got excited about Pose but when I tried it out I saw a lot of unexpected and undocumented behavior. Seems promising but docs needs more work and examples!

Creator here - have you got any specific examples of this behaviour? I’d be glad to hear of them

I was trying to create a slide down animation, but could not figure out if Pose is dependent on the height property or not. Some times transforms worked-ish and sometimes not.

Re: Learn React by building a web app

#104

Earlier quoted context omitted.

Creator here - have you got any specific examples of this behaviour? I’d be glad to hear of them

I was trying to create a slide down animation, but could not figure out if Pose is dependent on the height property or not. Some times transforms worked-ish and sometimes not.

Hmm probably because height and width are converted to transforms as FLIP animations. Maybe I’ll look into making that opt-in. Thanks dude.

Re: Learn React by building a web app

#107
post #52
post #32

Earlier quoted context omitted.

I feel this way about React but Redux seems awkward and worthy of replacement. Am I in the minority on this?

I created my own library after finding redux boilerplate heavy. I haven't publicized it yet, but you can see it here - https://github.com/gunn/pure-store It supports full typescript typing, and uses Immer to allow very direct store updates with immutability.

Wow that look amazing, how can I subscribe react to the store? Will each component need something like mobx observer?
Post reply on HN