It was not long ago that I struggled terribly over React. Then I gave up on it because it seemed too hard, way over my head and much overkill. I opted for Plain JS.
Someone used the term Spaghetti Code and told me that if I have many pages in my app that React would be useful. Then I read about reusable components in React. I have a Java background. It now seems that React is much like Java where we do subclassing. The next page inherits the behavior from a previous page.
Am I having an aha moment?
I think, for example, I can put some css or a listener in a component, then reuse the same on all my subsequent pages so I don't have to rewrite this code on each page (the spaghetti).
aha !!
PS: I also wrote a Dev article about my React Struggles here
https://dev.to/rickdelpo1/react-vs-plain-js-3cpk
Yeah, the power of react is keeping the document structure of the DOM tied to the relevant function code
In addition. Libraries like Recoil or Jotai are easier to use than Redux (which I won't touch. Because I don't want my head to hurt)
The library, styled-components solves another problem, by letting you put your CSS and styles in the same file with your JSX and JavaScript.
Learning to write hooks is nice too.
React makes a lot of things better but it's not perfect, and I could understand where it's easy to get side effects and bang your head. Try making small components and nesting everything together.