chapter icon indicating copy to clipboard operation
chapter copied to clipboard

React Class Components VS Functional Components w/hooks

Open timmyichen opened this issue 7 years ago • 19 comments

Title says it all. What's our opinion on using class components vs functional components with hooks?

timmyichen avatar Oct 22 '19 03:10 timmyichen

I'm down for Hooks since that is the latest and greatest. Plus it will save us a refactor later.

chrismgonzalez avatar Oct 22 '19 03:10 chrismgonzalez

I'm also down for hooks, but I'm wondering if it will be yet another barrier to entry given that most resources online are written using class components.

timmyichen avatar Oct 22 '19 03:10 timmyichen

In that case I would just point to React docs. They're going to have to learn anyways, right?

chrismgonzalez avatar Oct 22 '19 03:10 chrismgonzalez

I suppose, but the less things people have to learn, the more people will contribute 🙃

timmyichen avatar Oct 22 '19 03:10 timmyichen

Let's see what others think over the next 24 hours? I am interested to hear the opinions of others.

chrismgonzalez avatar Oct 22 '19 03:10 chrismgonzalez

I think say we use fc + hooks and also be considerate in thinking about giving low hanging fruit as starter issues - that might lead to them understanding hooks better

Abott1222 avatar Oct 22 '19 04:10 Abott1222

I recommend Functional Component + hooks. As @chrismgonzalez mentioned that it will save time of refactoring.

imVinayPandya avatar Oct 22 '19 05:10 imVinayPandya

Functional Components + Hooks. @timmyichen Converting Class components to Hooks won't be much of a problem, besides there are VS Code extensions to do the same (in worst case scenario).

abidRahim avatar Oct 22 '19 07:10 abidRahim

Functional components + hooks 100%.

Hooks will allow us to abstract out complex bits of logic which if anything lowers the barrier to entry since newcomers won't have to deal with them.

rinajhinjhina avatar Oct 22 '19 13:10 rinajhinjhina

Hooks 100% of the way, I think they'll be a lot easier to pick up than most people think.

nulfrost avatar Oct 22 '19 13:10 nulfrost

I think hooks is a good way to go with!

vardhanapoorv avatar Oct 22 '19 15:10 vardhanapoorv

Sounds like it's pretty unanimous! :+1: Lets go hooks! ↩️

timmyichen avatar Oct 22 '19 15:10 timmyichen

Hooks 👍

ghost avatar Oct 23 '19 00:10 ghost

Functional Component + hooks, GitHub should add a polling button, is there a pull request to update the documentation regarding this? @timmyichen

xarielx avatar Oct 23 '19 01:10 xarielx

Negative - feel free to create one!

timmyichen avatar Oct 23 '19 01:10 timmyichen

Should we install this to facilitate future discussion of this kind? https://github.com/apps/polls @timmyichen @chrismgonzalez

xarielx avatar Oct 23 '19 02:10 xarielx

/polls React Class Components 'Functional Components w/hooks'

QuincyLarson avatar Nov 15 '19 19:11 QuincyLarson

We've resolved during our Nov 15 meeting:

Hooks are the norm. Classes can be used when needed.

QuincyLarson avatar Nov 15 '19 19:11 QuincyLarson

Meeting Notes with more on the decision to use hooks. https://github.com/freeCodeCamp/chapter/wiki/Meeting-Notes-November-15,-2019

allella avatar Nov 16 '19 00:11 allella