Experimenting with hot reloading again. Found an approach that seems to work well for hot reloading Hooks. Would require some tweaks in React though.pic.twitter.com/2WueEBfkT1
-
-
Build-time plugin composes a signature for each component. A signature contains each use* call in component body with: 1. its name 2. stringified LHS of how its result is used It also composes signatures of every custom Hook inside. (Each is defined with same mechanism.)
-
Something like this for final example: useHNSearch.__signature__ = 'useState{const [data, setData]} useEffect'; SearchResults.__signature__ = 'useState{const [page, setPage]} useHNSearch{const data}' + '!' + useHNSearch.__signature__;
- 7 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
he/him 