You Can’t Use Hooks Conditionally… or Can You? by Charlotte Isambert
The video delves into the intricacies of React's fiber tree and how it manages component rendering. A significant focus is on the proposed 'Use' hook, which can be used conditionally, unlike other hooks such as useState. This capability stems from how useContext operates independently of the typical hook sequence, making it a unique case for conditional use. The video explains why React conditional hooks like useContext can be used without disrupting the hook order, which is crucial since other hooks cannot be used conditionally due to their reliance on a specific call order. React conditional hook usage is further explored by demonstrating how context values are updated, impacting the rendering of components. The fiber tree's role in tracking component data and optimizing re-renders is highlighted, emphasizing the importance of maintaining the correct order of hook calls. Conditional hooks in React are a nuanced topic, with the video providing insights into how the fiber tree and context values interact to allow certain hooks to be used conditionally.
gitnation.com