This recipe provides a collection of codemods to help you migrate your codebase to Valtio v2. These codemods are designed to streamline the transition process by automating common code transformations due to behavioral changes in Valtio v2.
Codemods Included
The following codemods are included in this recipe:
- 
Proxy Function Behavior Update 
 Updates instances ofproxy(obj)to usedeepCloneto ensure objects are deeply copied as in Valtio v1. This adjustment is necessary due to the change from a pure function in v1 to an impure function in v2 that modifies the original object.
- 
useSnapshotBehavior Adaptation
 Modifies the usage ofuseSnapshot()to be compatible with recent changes for better optimization withuseMemoand the upcoming React compiler. This includes wrapping snapshot data withuse()to ensure compatibility and performance.
Build custom codemods
Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community