feat: support use hook
close #4756
📊 Tachometer Benchmark Results
Summary
A summary of the benchmark results will show here once they finish.
Results
The full results of your benchmarks will show here once they finish.
As I tried to make clear in my suggestions/comments, the philosophy of preact is to optimize for performance and size. We should also not leak implementation details into core for the sake of it.
EDIT: thinking more about the PROMISE_CACHE, I think I know what you were going for with persisting across discarded renders in relation to the missing lifecycle problem. As we assume the Promise identity to be stable we could hang the value off of that and re-hydrate it though so I think we are safe there. It would have been easier to realise what you were going for with a description for the PR.
Second to @rschristian. use is intentionally designed to be semantically order-insensitive (it's not a real "Hook" in the sense that it doesn't allocate a hook node/slot in the Fiber), so we shouldn't implement it on top of existing order-sensitive hooks.