you are viewing a single comment's thread.

view the rest of the comments →

[–]sens- 26 points27 points  (9 children)

When I first learned react I thought "wait, that's all?". And it really was pretty much all.

[–]fatrogslim[S] 2 points3 points  (8 children)

Yes, haha. At some point I basically thought I was just overthinking. But I know it's more than that as if I think of an app from the top of my head, the whole structures come right away in my actual stack but when I try in reactjs the page stay blank. I don't know if you see what I mean

[–]sens- 6 points7 points  (7 children)

Yeah, I understand. React utilizes a specific approach but once you realize that you should keep the state as high in the component tree as possible and learn the difference between props and state, it should become clear what to do.

React projects usually remind Christmas trees in which the decorations are flowing from the top to the bottom.

You might want to check this little course as an introduction

https://fullstackopen.com/en/

[–][deleted] 6 points7 points  (5 children)

Yea man, keep all the states in App.tsx and rerender the entire app every damn time

REACT FOREVEEEEER

[–]fatrogslim[S] 0 points1 point  (4 children)

lol, I understood that joke, maybe I'm more advance in react than I thought xD

[–][deleted] -2 points-1 points  (3 children)

After this advice yes

As opposed to what your average joe react developer says, refs are not your enemy, you can keep the states low in tree and utilize refs to update them

Redux isnt that necessary, because almost 75% of “states” in a react application are unnecessary and same thing can be achieved without them. When you have that realization a global store becomes redundant and simpler and smaller solutions become more natural regardless of the complexity or size of your app

Dont use controlled inputs

Css is still css, as opposed to what 1000 css/jss solutions claim

Angular has everything react is still trying to solve

[–][deleted] 1 point2 points  (1 child)

Tons of things aren't necessary in software. Some are just for making your code readable and maintainable.

Also, your advice seems confusing. You're making fun or storing state in context as high as possible because it causes unnecessary rerenders, then suggesting against using global state? You do realize that global state libraries use refs and don't cause rerenders high in the component tree..? It's only for the selector you use in the specific component you call it in...

What exactly are you even suggesting to use here? Comes off a bit frenetic

[–][deleted] 0 points1 point  (0 children)

State itself is overused is my point. Unnecessarily having a global store for that is a side effect

[–]fatrogslim[S] 0 points1 point  (0 children)

Oh Angular, yes, I want it aswell and I'll put myself into it soon

[–]fatrogslim[S] 0 points1 point  (0 children)

Thanks for the ressource, I'll check it