Upvoted despite your final sentence being incorrect. :-) You're absolutely right that React is miles better than Angular, but Svelte and Vue (which feel very similar to each other, I just switched from one project written in Svelte to a different project written in Vue and a lot of my knowledge is carrying over) are quite a lot easier than React. When I write in React I have to think about the hooks and when I'm initializing them; when I write in Svelte or Vue the $state/ref() systems just work and I don't have to think about them. I can even initialize a $state inside an if block if I need to; I admit I'm no React expert, so I should ask you. If you needed to create a piece of state inside an if block in React, how would you do it? Is the only answer "Move the hook call outside the if block, and just don't use it if the if block doesn't run"?
We'd probably have to talk about it IRL; the question you're asking kind of implies you're coming at the whole thing from the wrong direction, and so any answer I give would be unsatisfying unless I could somehow transfer the entire philosophy in my head to you.
The short answer is that what you're asking doesn't really make sense to me. I think of the lifetime of state as analogous to member variables of a class. In the same way that member variables in a class are always visible to the entire class, a state variable in React is always visible to the entire component. You wouldn't want it to be scoped to an if block any more than you'd want a member variable to be scoped to an if block.
Maybe now you're thinking "well, that's limited in an annoying way, and Svelte is better". Maybe. But I suspect for any problem that exists that you think needs conditionally-scoped state, there's a nice clean solution in React. That's what I suspect, anyways. But I very rarely run into problems in React that I can't express in nice, clean code.
That someone can initialize a state in if block is not something good. React won with Angular 1.0 because noobs abused two-way binding making fking mess everywhere. Now in react they abuse useEffect but it’s a bit easier to control. I work currently in Svelte and never use 2-way binding and are careful to package state mgmt well but I like it. It’s similar to react with mobx but more performant although has no good component libraries. SvelteKit is also generally fine