Refactor ProfilerContext to use reducer instead of multi-state #16444
Labels
Component: Developer Tools
React Core Team
Opened by a member of the React Core Team
Type: Enhancement
The
ProfilerContext
is currently comprised of several pieces of related state, each managed withuseState
. This necessitates awkward checks like this or even worse like this or this.This context should be refactored to use a single reducer (
useReducer
) likeTreeContext
. This is a bit more involved at the moment because of suspense and theProfilerContext
being higher level than the suspense cache. Although maybe we could work around this by using some sort of subscription?See related issues like #16441 and commit 4697f5b.
The text was updated successfully, but these errors were encountered: