CodeYourFuture / syllabus-archive

[ARCHIVED] Please use https://github.com/CodeYourFuture/syllabus
https://codeyourfuture.github.io/syllabus-master
74 stars 114 forks source link

React improvements #292

Closed 40thieves closed 5 years ago

40thieves commented 5 years ago

A few minor changes to the React module, based on feedback from teaching London class 5. Summary of the changes:

I'm aware that this may have some conflicts with @llh1's PR, but happy to get that merged first and can then deal with the conflicts.

llh1 commented 5 years ago

My only concern about removing completely constructor() is that students may see a lot of examples on the web including the official documentation on React which uses constructor and may be clueless about this if we never introduce it. If using the class syntax, I feel overall we see more often React components written using constructor than without.

40thieves commented 5 years ago

My only concern about removing completely constructor() is that students may see a lot of examples on the web

Right. I also have this concern (actually if I could control what students were looking at, then we'd teach class components first - less context switching).

I would say that we did "waste" about 20 - 30 mins of class in London talking about class inheritance, which imo is not particularly efficient use of time (especially with Hooks, and the need for classes going away).

Perhaps we could add a short section explaining what the state class property does, and explain it with the use of a constructor?

including the official documentation on React

That is a good point.

40thieves commented 5 years ago

I'll also get this rebased

40thieves commented 5 years ago

@llh1 Was discussing this with Neill from London earlier today. To push this over the line I'm happy to revert the constructor change if you're still against it. I'd like to try switching over to Hooks for our next class anyway, which makes classes somewhat redundant.

llh1 commented 5 years ago

@40thieves Yes if you don't mind, i'd prefer to keep constructor for now as i think it's still more straightforward to explain just one way of doing things aligned with the documentation available on the web. But let's keep the discussion open on this, I'll pay attention of the students' response to this in few weeks in Glasgow and I'll let you know about it.

40thieves commented 5 years ago

@llh1 I've pushed revert for the constructor changes (and fixed a missing super(props) call I spotted). Are you happy with this approach?

llh1 commented 5 years ago

@40thieves That's great :) thanks!