from Hacker News

Enabling custom "god" react hooks that don't trigger unexpected re-renders

by campbellman on 10/31/23, 7:46 PM with 1 comments

  • by campbellman on 10/31/23, 7:46 PM

    I was working on an app that had a ton of app logic within a single custom react hook. The hook's return value was passed to a context provider, which was a re-render nightmare. The code was hard to optimize without breaking the logic up into many smaller contexts. Rather than doing that, I wrote this library instead so that the hook's return values were accessible in "re-render safe" ways. It's a WIP, so feedback is welcome :)