DEV Community

Discussion on: Becoming Friends with React JS

Collapse
 
dance2die profile image
Sung M. Kim

It's still a bit controversial which one to use between class components (CC) and function (not functional) component (FC).

I'd suggest to learn FC first but also learn about CC as CC is still widely used and there are things that FC cannot do but CC can.

And alsoshoukd I learn Context In react or go for NextJs as a SSR

Context API is a core React feature, so you'd actually want to learn. Context API has its own use cases where you won't need Redux for.

You can check out the discussions about FC vs. CC here.

  1. reddit.com/r/reactjs/comments/g2pd...
  2. reddit.com/r/reactjs/comments/fr7x...
Collapse
 
hemant profile image
Hemant Joshi

Thanks a lot Sung,
I got a bit clear image what to do next😁, will suerly go for context Api starting from tomorrow before touching NextJs...

Also I am bit good in ReactJS, where I am using Functional Components daily, and from now will look for the reasons to use CC or FC for sure....

Ps: In First comment there was mistake with my Autocorrect in last line..

Thread Thread
 
dance2die profile image
Sung M. Kim

You're welcome there, Hemant :)

After learning the Context API, you need to be careful on setting it up on NextJS, as it's an SSR (server-side rendering) framework. On each page refresh, context state is gone.

So you'd need to set up the context in what's called a special file, pages/_app.js, which you can read about here -> reacttricks.com/sharing-global-dat...

Thread Thread
 
hemant profile image
Hemant Joshi

YesπŸ€”, will take care of it