Post

Happy to announce Octane – the successor to Inferno. React’s programming model, compiled. Hooks, Suspense and Actions, compiled ahead of time. No virtual DOM. No Rules of Hooks. No manually maintained dependency arrays. The compiler understands what your code. octanejs.dev

conditional hooks are semantically a little different from React what do the hooks do if the branch isn't taken? does useEffect run its cleanup? does useState discard its state? etc

No to either. useState will persist, and useEffect will only trigger it's cleanup if it's to run again, or the component unmounts

0 reposts1 like

doesn't that violate declarativity? e.g. if I have if (shouldSubscribe) { useEffect(...) } and shouldSubscribe is true on first render but changes to false, clearly this subscription should be cleaned up