Please help me, I don’t know how to learn react any more

Please I’m very confused in regards to learning React js. I recently finished with my vanilla js and decided to learn react but I made a mistake by learn functional components with hooks first and now am very stocked. I can’t find any book on react that doesn’t use class, and I learn easily by reading it first.

I have tried to read books written in class but because they’re all written using before hooks standards, I can’t concentrate because I feel am just wasting my time.

Please what should I do, should I go ahead and read the class state approach and if yes, please encourage me on how to be focused and read it.

The most annoying part is that my create react-app has only function State component and not class.

I don’t think it’s a problem.

Hooks on functional components are made to write less code. You can use both to learn, it doesn’t matter if you want to use classes or use hooks, they both do their job.

The hooks are relatively new, so you are unlikely to find books on them.

Like me, I learn by reading first, so I recommend that you read the official documentation or read other hook pages so you can learn more.

First I learned the classes, then I wanted to learn hooks, but it was very complicated, I did not understand. Then, when I mastered the classes well, I tried using the hooks again and it became very simple. So much so that the last project I did, I did with hooks. Since you know how to use hooks, using classes will be relatively easy for you.

create-react-app includes classes and hooks.

1 Like

Okay, thanks so much. I will try and learn the class. Which books did you read on react?

I did not read books. I learned the basics with the courses here, and increased my knowledge with the official documentation and reading on other pages when I was doing the projects.

On the official page there are tutorials with the classes, I recommend you take a look.

To be honest, I had a hard time understanding React. But with a lot of effort I can now do things that previously seemed impossible to me.
Do not be discouraged if you do not understand the first time, we have all found it difficult to learn new things. Once you achieve your goal, you will say to yourself, “Wow, it wasn’t as difficult as I thought.”

Good luck :smiley:

1 Like

Thanks so much, I honestly appreciate you patients with me.

Please how do I migrate from functional component that’s given on default when installing create-react-app.
I tried to convert the component to class by deleting all the stuffs inside the app.js.

I imported the react, created a new component using .jsx, I create a simple hello world in the class component and tried to view it by import it into index.js but it and changing the <./app.js> on the render and putting my component name. But it didn’t work instead it was showing failed compilation, the import is not found on my dir.

I don’t know what else to do, no one to ask, I’m just teaching myself blindly.

Please am sorry for the long read.

I would strongly advise following the tutorials in the documentation, and if you want to use a book, use one written in the past year. There isn’t an issue with using classes, and older books will use them, but basically all newer documentation for React (both React itself and any libraries) is going to be using functions + hooks.

There is a wealth of documentation, tutorials, articles etc all using the class API, as up until a couple of years ago, that was all there was. But everything has migrated fast to hooks, and if you are learning it now, as a beginner, it makes sense to stick with what is now a standard API.

This is a seperate issue, and it’s because the file doesn’t have anything exported that matches the thing you’re trying to export. You’ve either missed out an export declaration or you’ve written something incorrectly (the file path or the syntax for export/import). It’s not to do with classes or functions.

1 Like