3 ms·
It does allow different ways of writing code and I agree that projects can be quite different architecture wise, but if I look at a component, I can be fairly c
by tiborsaas 3y ago
It does allow different ways of writing code and I agree that projects can be quite different architecture wise, but if I look at a component, I can be fairly certain that:
- Its return value is a some kind of UI (I know about contexts)
- Not using hooks, the variables in the JSX are side effect free
- Using hooks will trigger a state update or you can prevent one
- A re-rendered component re-renders the whole subtree
I meant that these few assumptions are shared in a project by every developer touching the project and they must work with these in mind. Abusing these will result in a rejected PR.
Can you still write bad react code? Absolutely, but at least I don't have to go back Adam and Eve to find what the hell is going on.