use-mutative icon indicating copy to clipboard operation
use-mutative copied to clipboard

Usage with React Context

Open IrvingArmenta opened this issue 1 year ago • 1 comments

I am considering in using mutative, but I must admit I lack experience to "safely" integrate this kind of library myself to the usage with React Context.

Is there an example I could see of how to implement a React Context using useMutativeReducer() ? and achieve the best performance possible?

It perhaps could follow the same example as React Docs -> https://react.dev/learn/scaling-up-with-reducer-and-context

IrvingArmenta avatar Aug 09 '24 01:08 IrvingArmenta

hi @IrvingArmenta , referring to the React documentation is a good choice. You should note that in useMutativeReducer, the state update logic in the reducer is 'mutative'. For example, this documentation https://github.com/mutativejs/use-mutative?tab=readme-ov-file#usemutativereducer

unadlib avatar Aug 10 '24 09:08 unadlib